Cancel
Showing results for 
Search instead for 
Did you mean: 

API to Extend Multiple Surfaces in a Single Operation

Siemens Phenom Siemens Phenom
Siemens Phenom

I tend to use the Geometry > Solid > Extend command frequently, so below (and attached) is a short API script that allows you to select multiple surfaces to extend to a selected surface in one operation.

 

The HTML Clipboard

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

    Dim rc As femap.zReturnCode

    Dim suSet As femap.Set
    Set suSet = App.feSet
    Dim su2Extend As Long

    Dim suID As Long

    SelectSurfaces:
    rc = suSet.Select ( FT_SURFACE, True, "Select Surfaces to Extend" )
    If rc <> FE_OK Then
        End
    End If

    rc = App.feSet.SelectID ( FT_SURFACE, "Select Surface to Extend To", suID )
    If rc <> FE_OK Then
        GoTo SelectSurfaces
    End If

    suSet.Reset
    su2Extend = suSet.First
    For i = 0 To suSet.Count-1
        App.feAppMessage ( FCM_COMMAND, "" )
        App.feAppMessage ( FCM_COMMAND, _
            ("Extending Surface" + Str$(su2Extend) + " to Match Surface" + Str$(suID)) )
        rc = App.feSolidExtendToSurface ( su2Extend, suID )
        If rc = FE_OK Then
            App.feAppMessage ( FCM_HIGHLIGHT, "Success" )
        Else
            App.feAppMessage ( FCM_ERROR, _
                ("Unable to Extend Surface" + Str$(su2Extend)) )
        End If
        su2Extend = suSet.Next
    Next i
    App.feViewRegenerate ( 0 )

    GoTo SelectSurfaces

End Sub

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development