rbas85
Structural
- Sep 23, 2019
- 7
I'm new to FEMAP API tools. I'd like to know how can I get the number of the elements of a group. I'm asking that because I'd like to loop through all elements of a determined group, save the number of these elements on a sheet and get their properties. I'm posting my code below:
Sub external_pressure_load()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Sheets("ExternalPressure")
Dim App As femap.Model
Set App = GetObject(, "femap.model")
Dim grp As femap.Group
Set grp = App.feGroup
Dim olel As femap.Set
Set olel = App.feSet
Dim grID As Long
Dim elID As Long
Dim i As Long
Dim el As femap.Elem
Set el = App.feElem
While grp.Next
grpID = grp.ID
If grpID = 3 Then
rc = olel.Clear()
rc = olel.AddGroup(FT_ELEM, grID)
elID = olel.First()
MsgBox grpID
i = 1
Do While elID > 0
rc = el.Get(elID)
ws1.Range("A" & i) = el
i = i + 1
elID = olel.Next()
Loop
End If
Wend
End Sub
Sub external_pressure_load()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Sheets("ExternalPressure")
Dim App As femap.Model
Set App = GetObject(, "femap.model")
Dim grp As femap.Group
Set grp = App.feGroup
Dim olel As femap.Set
Set olel = App.feSet
Dim grID As Long
Dim elID As Long
Dim i As Long
Dim el As femap.Elem
Set el = App.feElem
While grp.Next
grpID = grp.ID
If grpID = 3 Then
rc = olel.Clear()
rc = olel.AddGroup(FT_ELEM, grID)
elID = olel.First()
MsgBox grpID
i = 1
Do While elID > 0
rc = el.Get(elID)
ws1.Range("A" & i) = el
i = i + 1
elID = olel.Next()
Loop
End If
Wend
End Sub