Cancel
Showing results for 
Search instead for 
Did you mean: 

femap API-feGetElementFaces

Creator
Creator

Does any API function like feGetElementFaces(),but without display a dialog

box(because I want this function run in silent,it run  in a great number of loops) while you can specify the guide element/face id/tolerance/limit elements like in the dialogbox below:

捕获.PNG

3 REPLIES

Re: femap API-feGetElementFaces

Siemens Phenom Siemens Phenom
Siemens Phenom

You could use "feGetElementFaces()" in conjunction with something like the program below.  Since that method returns an array of element and face ids, you could feed it into "GetFaceNodes2" or something similar.

 

I put a break point on "Next i" to highlight different "face nodes"

 

Face Nodes.png

 

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

    Dim eSet As Set
    Dim nSet As Set
    Set eSet = App.feSet
    Set nSet = App.feSet

    Dim e As Elem
    Set e = App.feElem

    Dim nFaceID As Long
    Dim nds As Variant, allNodes As Variant

    e.Next()
    allNodes = e.Nodes
    For i = 1 To UBound(allNodes)
        If i < 8 Then
            nFaceID = i
        Else
            Exit For
        End If
        e.GetFaceNodes2(True,nFaceID,nds)
            nSet.Clear()
            nSet.AddArray(UBound(nds),nds)
            nSet.Show(FT_NODE)
    Next i

End Sub

Re: femap API-feGetElementFaces

Creator
Creator

@RCatania,thank you , but my trouble is when I use feGetElementFaces() in a loop , every cycle, the API need user to enter parameter manually,if the loop cycle is too many, it is unbearable, the GetFaceNodes2() can not achieve the capacity of picking up Adjacent faces supplied by feGetElementFaces() API. one function in my program related to this API is following:
Public Sub Create2DNotation(arrNotation As ArrayList)
arrNotation.Clear() '清空Notations
Dim set1, set2, set3, set3a As femap.Set
set1 = feApp.feSet
set2 = feApp.feSet
set3 = feApp.feSet
set3a = feApp.feSet

For i As Integer = 0 To arrGroups.Count - 1
rc = set1.AddGroup(FT_ELEM, arrGroups(i))
Next i

rc = set2.AddRule(FTO_TRIA3, FGD_ELEM_BYSHAPE) '三角形单元
rc = set2.AddRule(FTO_QUAD4, FGD_ELEM_BYSHAPE) '四边形单元
rc = set1.RemoveNotCommon(set2.ID) 'make set1 to contain 2D elem in active group

set2.clear()
rc = set2.AddSetRule(set1.ID, FGD_PROP_ONELEM) 'make set2 to contain plate prop in active group
If set2.Count() > 50 Then
rc = feApp.feAppMessage(FCM_ERROR, "Too many 2D shell properties.")
Exit Sub
End If

Dim mat As femap.Matl
mat = feApp.feMatl

Dim pr As femap.Prop
pr = feApp.feProp

Dim t As Double

Dim len, area, vol, sMass, nsMass, tMass As Double
Dim objCG, objSCG, objNSCG, tCG, inertia1, inertia2 As Object

Dim maxCycle As Long = 100000

set2.Reset()
While set2.Next()
Dim tClsNotation As New clsNotation
tClsNotation.pID = set2.CurrentID
'计算notation文字
rc = pr.Get(set2.CurrentID)
rc = pr.thickness(t, t, t, t)
mat = pr.Matl()
If Abs(mat.TensionLimit1 - 235) < 0.1 Then
tClsNotation.Text = t & "~" & "MS"
ElseIf Abs(mat.TensionLimit1 - 315) < 0.1 Then
tClsNotation.Text = t & "~" & "HT32"
ElseIf Abs(mat.TensionLimit1 - 355) < 0.1 Then
tClsNotation.Text = t & "~" & "HT36"
ElseIf Abs(mat.TensionLimit1 - 390) < 0.1 Then
tClsNotation.Text = t & "~" & "HT40"
Else
tClsNotation.Text = t & "~" & "MS"
rc = feApp.feAppMessage(FCM_WARNING, "材料等级未定义,默认为MS")
End If

'cal notation pos.
set3.clear()
rc = set3.AddRule(pr.ID, FGD_ELEM_BYPROP)
rc = set3.RemoveNotCommon(set1.ID) 'set3 contain only elems using current prop

Dim i As Long = 0
While (set3.Count() > 0) And (i < maxCycle)
Clipboard.Clear()
rc = set3.CopyToClipboard(True)
Dim str1 As String = "{~4029}<A-A><@11141>"
str1 = str1 & set3.First().ToString() & "<@11710>1<@12001><PUSH><@12504><PUSH><A-C><P><P><enter><OK><OK>"
rc = feApp.feFileProgramRun(False, False, False, str1)
Running_LABEL:
If feApp.feFileProgramRunning() = FE_OK Then
GoTo Running_LABEL
End If

Dim a() As String = Clipboard.GetText().Trim().Split(Nothing)
set3a.clear()
For ii As Integer = 0 To UBound(a)
rc = set3a.Add(CInt(a(ii)))
Next

objCG = Nothing : objSCG = Nothing : objNSCG = Nothing : tCG = Nothing
inertia1 = Nothing : inertia2 = Nothing
rc = feApp.feMeasureMeshMassProp(set3a.ID, 0, False, False, len, area, vol,
sMass, nsMass, tMass, objSCG, objNSCG, objCG, inertia1, inertia2)
Dim pt As New Point3D
pt.x = objSCG(0)
pt.y = objSCG(1)
pt.z = objSCG(2)

tClsNotation.arrPt.Add(pt)
set3.RemoveSet(set3a.ID)
i = i + 1
End While
arrNotation.Add(tClsNotation)
End While
End Sub

 

***************************

I use feFileProgramRun() to run a macro like the user maually enter parameter for feGetElementFaces() , but I do not think it is a perfect solution,it is just a alternative solution wihout thinking out other more good medhod.

Re: femap API-feGetElementFaces

Siemens Phenom Siemens Phenom
Siemens Phenom

Creator,

 

A new method to accomplish this will be included in an upcoming release of Femap.