TadeuszSz
Marine/Ocean
- Feb 26, 2015
- 5
Hi All,
First I'd like to say hello to everyone. This is my first post here.
Would you kindly advise what is wrong with this piece of code?
Working with Femap 11.
I try to create groups based on information from layers. I started from surfaces and found incomprehensible problem at once.
API creates groups but somehow it summing up surfaces IDs from previous step. Looks like clear function is ignored but no. IDs listed in each step are correct.
For single layer (no loop) api works correctly. Thank in advance.
Tadeusz
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim layer_ As femap.layer
Set layer_ = App.feLayer
Dim group_ As femap.Group
Set group_ = App.feGroup
Dim surfOnLayer_set As femap.Set
Set surfOnLayer_set = App.feSet
Dim layerName As String
Dim layerID As Long
Dim group_ID As Long
While layer_.Next 'go throgh all layers
If (layer_.ID <> 1) And (layer_.ID <> 9999) Then ' exluding these
'take layer
layer_.Get(layer_.ID)
layerName = layer_.title
App.feAppMessage(FCM_NORMAL, "Working on layer :" & Str(layer_.ID) &"=>" & " " & layerName )
surfOnLayer_set.Clear()
surfOnLayer_set.AddEntitiesOnLayer( -(layer_.ID), FT_SURFACE) ' collect surfaces in the set
' time to create group
group_ID = group_.NextEmptyID
group_.Get(group_ID)
group_.title = layerName
group_.SetAdd(FT_SURFACE, surfOnLayer_set.ID) ' add surfaces from the set
group_.Put(group_ID)
End If
Wend
End Sub
First I'd like to say hello to everyone. This is my first post here.
Would you kindly advise what is wrong with this piece of code?
Working with Femap 11.
I try to create groups based on information from layers. I started from surfaces and found incomprehensible problem at once.
API creates groups but somehow it summing up surfaces IDs from previous step. Looks like clear function is ignored but no. IDs listed in each step are correct.
For single layer (no loop) api works correctly. Thank in advance.
Tadeusz
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim layer_ As femap.layer
Set layer_ = App.feLayer
Dim group_ As femap.Group
Set group_ = App.feGroup
Dim surfOnLayer_set As femap.Set
Set surfOnLayer_set = App.feSet
Dim layerName As String
Dim layerID As Long
Dim group_ID As Long
While layer_.Next 'go throgh all layers
If (layer_.ID <> 1) And (layer_.ID <> 9999) Then ' exluding these
'take layer
layer_.Get(layer_.ID)
layerName = layer_.title
App.feAppMessage(FCM_NORMAL, "Working on layer :" & Str(layer_.ID) &"=>" & " " & layerName )
surfOnLayer_set.Clear()
surfOnLayer_set.AddEntitiesOnLayer( -(layer_.ID), FT_SURFACE) ' collect surfaces in the set
' time to create group
group_ID = group_.NextEmptyID
group_.Get(group_ID)
group_.title = layerName
group_.SetAdd(FT_SURFACE, surfOnLayer_set.ID) ' add surfaces from the set
group_.Put(group_ID)
End If
Wend
End Sub