Cancel
Showing results for 
Search instead for 
Did you mean: 

API Feature Editing commant

Creator
Creator

Hello everyone

 

I am trying to create an API which basically mimics the fanctionality of the Feature Editing (Translate and Rotate Surfaces) from the Meshing Toolbox.

Unfortunately I can not found anywhere the proper commant on the API help.

Can anyone help? Does anyone know something about it, or how can I do it????

 

Thank you in advance

5 REPLIES

Re: API Feature Editing commant

Siemens Genius Siemens Genius
Siemens Genius

Those specific tools are not accessible from the API. However multiple methods can be used to mimic this. If you are simply moving/rotating a surface with shells you could move/rotate the surface by App.feMove(…)/App.feRotateBy(...) and then move or rotate the shell elements by that same amount.

 

What exactly are you looking to accomplish? 

Re: API Feature Editing commant

Creator
Creator

I have two surfaces, one somewhere inside the other. I need to rotate and move the inner surface along the outer.
The commands of the Feature Editing are the best for my case.

I want to create an API (which is going to be part of a bigger one), that will change the positon of an inner surface several times.

I can use instead of, the feRotateBy, feMoveBy, feSolidcleanup, and feProjectOntoSurface. After that, I have to delete and remashing again. This way I will have the same result. But it is more complicate and I hope to find an easier way

Re: API Feature Editing commant

Creator
Creator

Bellow are some picture as an example

 

1.png2.png3.png4.png5.png6.png

Re: API Feature Editing commant

Siemens Phenom Siemens Phenom
Siemens Phenom

This is a very interesting question.  FEMAP Development is discussing exposing functionality from the Meshing Toolbox via the API.

 

In the meantime, I've created a script that will hopefully accomplish what you are looking for.  The solution that worked for me was "feMoveBy(FT_CURVE...)".  This behavior is what is happening in the Meshing Toolbox.

 

 

First.bmp.pngSecond.pngThird.pngfourth.pnglast.bmp.png

 

 


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

    Dim cSet As Set
    Dim surfSet As Set
    Dim solidSet As Set
    Dim elemSurfSet As Set
    Dim meshSet As Set
    Dim s As Surface
    Dim c As Curve
    Dim e As Elem

    Set cSet = App.feSet
    Set surfSet = App.feSet
    Set solidSet = App.feSet
    Set elemSurfSet = App.feSet
    Set meshSet = App.feSet
    Set s = App.feSurface
    Set c = App.feCurve
    Set e = App.feElem

    'Translate
    Dim vecLength As Double
    Dim vecBase As Variant
    Dim vecDir As Variant

    'Rotate
    Dim origin(2) As Double, axis(2) As Double
    Dim angle As Double, value As Double
    Dim baseROT As Variant, vecROT As Variant

    Begin Dialog UserDialog 210,98,"Meshing Toolbox Mimic" ' %GRID:10,7,1,1
        OptionGroup .Group1
            OptionButton 20,14,190,14,"Translate Surface(s)",.TranslateS
            OptionButton 20,35,140,14,"Rotate Surface(s)",.RotateS
        OKButton 10,63,90,21
        CancelButton 110,63,90,21
    End Dialog
    Dim dlg As UserDialog
    If Dialog (dlg) = 0 Then End

    If surfSet.Select(FT_SURFACE,True,"Select Surface...") <> FE_OK Then End

    While surfSet.Next()
        cSet.AddRule(surfSet.CurrentID,FGD_CURVE_ONSURFACE)
        solidSet.AddRule(surfSet.CurrentID,FGD_SOLID_BYSURFACE)
        solidSet.Reset()
        While solidSet.Next()
            'The surfaces to delete mesh from, and re-mesh from
            elemSurfSet.AddRule(solidSet.CurrentID,FGD_SURFACE_ONSOLID)
        Wend
    Wend

    If App.feVectorPickByMethod(FVD_POSITION_LENGTH,"Specify Vector",False,vecLength,vecBase,vecDir) <> FE_OK Then End

    Select Case dlg.Group1 'If the Radio Button was Translate
        Case 0
            rc = App.feMoveBy(FT_CURVE,cSet.ID,False,vecLength,vecDir)
        Case 1
            If App.feGetReal("Rotation Angle (Deg)",-365,365,value) <> FE_OK Then End
            rc = App.feRotateBy(FT_CURVE,cSet.ID,vecBase,vecDir,value,0)
        Case Else
            App.feAppMessage(FCM_NORMAL,"Something went wrong.")
            End
    End Select

    'Have to delete the mesh and re-mesh (On Surface(s)!)
    elemSurfSet.Reset()
    While elemSurfSet.Next()
        meshSet.Clear()
        meshSet.AddRule(elemSurfSet.CurrentID,FGD_ELEM_ATSURFACE)
        App.feDelete(FT_ELEM,meshSet.ID)
        meshSet.Clear()
        meshSet.AddRule(elemSurfSet.CurrentID,FGD_NODE_ATSURFACE)
        App.feDelete(FT_NODE,meshSet.ID)
    Wend

    minBetween = 1  :   maxAspect = 100  : maxQuickNodes = 1 :  meshApproach = 5 'Quad
    quadAngle = 45  :   midSideGeom = True  :   midSideAngle = 0.0
    smoothLaplacian = False 'Laplacian smoothing
    smoothIter = 0 :    smoothTol = 100

    'Remesh
    elemSurfSet.Debug
    rc = App.feMeshSurface2(elemSurfSet.ID,0,0,False,False)

End Sub

 

 

 

 

Re: API Feature Editing commant

Creator
Creator

This is a very nice API. Thank very very much. You helped me alote.

Thank you again...!!!