cancel
Showing results for 
Search instead for 
Did you mean: 

Converting to Wireframe for beam modeling

Experimenter
Experimenter

Hi,

I have attached a parasolid file of a roll cage and am wondering what the best way is to convert it a wireframe model so I can mesh with beam elements. Any help would be appreciated.

Thank you

3 REPLIES

Re: Converting to Wireframe for beam modeling

Siemens Phenom Siemens Phenom
Siemens Phenom

I wrote this API that will find the centerlines of the straight tubes.  You will still have to do some trimming and extending, and also do the couple of curved pieces by hand.  We're working on some auto centerline code for FEMAP v11.4, and your part has given us some ideas, we'll try to get some of this inside FEMAP for the next release, here's the API for now, I hope it helps - the codes turns off the visibility of each solid it processes so you can see which ones got done.

 

RollCage.jpg

 

The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim feSurf As femap.Surface
    Set feSurf = App.feSurface

    Dim radius As Double
    Dim baseVec As Variant
    Dim normVec As Variant
    Dim surfCG As Variant
    Dim cylCG As Variant
    Dim pt2(2) As Double

    Dim endA(2) As Double
    Dim endB(2) As Double

    Dim ctrPt As Variant

    Dim soSet As femap.Set
    Set soSet = App.feSet
    Dim cuSet As femap.Set
    Set cuSet = App.feSet

    Dim maxLength As Double
    maxLength = 0.0

    Dim feCurve As femap.Curve
    Set feCurve = App.feCurve

    Dim surfArea As Double
    Dim surfID As Long
    Dim feSolid As femap.Solid
    Set feSolid = App.feSolid
    Dim suSet As femap.Set
    Set suSet = App.feSet

    Dim cyl_suSet As femap.Set
    Set cyl_suSet = App.feSet
    Dim sArea As Double

    While feSolid.Next = FE_OK
        surfArea = 0.0
        surfID = 0
        suSet.Clear()
        suSet.AddRule( feSolid.ID, FGD_SURFACE_ONSOLID )
        feSurf.Reset
        While feSurf.NextInSet( suSet.ID) = FE_OK
            If feSurf.IsCylinder() = FE_OK Then
                feSurf.Area( sArea )
                If sArea > surfArea Then
                    surfID = feSurf.ID
                    surfArea = sArea
                End If
            End If
        Wend
        If feSurf.Get( surfID ) = FE_OK Then
            If feSurf.IsCylinder() Then
                If feSurf.Cylindrical( radius, baseVec, normVec ) = FE_OK Then
                    If feSurf.cg( surfCG ) = FE_OK Then
                        App.feViewShow( FT_SURFACE, -feSurf.ID )
                        pt2(0) = baseVec(0) + normVec(0)
                        pt2(1) = baseVec(1) + normVec(1)
                        pt2(2) = baseVec(2) + normVec(2)
                        If App.feCoordOntoLine( surfCG, baseVec, pt2, cylCG ) = FE_OK Then
                            soSet.Clear
                            cuSet.Clear
                            maxLength = 0.0
                            soSet.AddRule( feSurf.ID, FGD_SOLID_BYSURFACE )
                            cuSet.AddRule( soSet.First(), FGD_CURVE_ONSOLID )
                            feCurve.Reset()
                            While feCurve.NextInSet( cuSet.ID ) = FE_OK
                                If feCurve.Length() > maxLength Then
                                    maxLength = feCurve.Length()
                                End If
                            Wend
                            If maxLength > 0.0 Then
                                maxLength = maxLength / 2.0
                                endA(0) = cylCG(0) + maxLength * normVec(0)
                                endA(1) = cylCG(1) + maxLength * normVec(1)
                                endA(2) = cylCG(2) + maxLength * normVec(2)
                                endB(0) = cylCG(0) - maxLength * normVec(0)
                                endB(1) = cylCG(1) - maxLength * normVec(1)
                                endB(2) = cylCG(2) - maxLength * normVec(2)
                                App.feLinePoints( False, endA, endB, True )
                                App.feEntitySetVisibility( FVIS_SOLID, -soSet.First, False, True )

                            End If
                        End If
                    End If
                End If
            End If
        End If
    Wend
End Sub

Re: Converting to Wireframe for beam modeling

Experimenter
Experimenter
Thank you very much.

Re: Converting to Wireframe for beam modeling

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Dear Mark,

Great API code!, it runs OK, good job. As a suggestion to improve the PAI it should be great if the output centerlines to go automatically to a new layer named CENTERLINES. To generate the centerline for the curved tubes I suggest to use command "Geometry > Curve - Spline > Midspline", the result is the following:

CURVE-MIDSPLINE.png

Best regards,
Blas.

Blas Molero Hidalgo, Ingeniero Industrial, Director
IBERISA • 48004 BILBAO (SPAIN)
WEB: http://www.iberisa.com
Blog Femap-NX Nastran: http://iberisa.wordpress.com/