There are 2 methods to do that:
1) using set difference
2) using track object
I will describe first one because it's easy and works in every femap version and track objects appeared in latest ones.
The idea is following: you create set and fill with all groups, run functions that generates groups, create one more set, fill with all groups and substract first set:
Dim groupBeforeSet As femap.Set Set groupBeforeSet = App.feSet groupBeforeSet.AddAll(FT_GROUP) 'function that generates groups Dim groupAfterSet As femap.Set Set groupAfterSet = App.feSet groupAfterSet.AddAll(FT_GROUP) groupAfterSet.RemoveSet(groupBeforeSet.ID)
Second method using TrackData. Similar to method with sets:
Dim trackObject As femap.TrackData Set trackObject = App.feTrackData trackObject.Start(FT_GROUP) 'call group generation function trackObject.Stop(FT_GROUP) Dim groupSet As femap.Set Set groupSet =App.feSet trackObject.Created(FT_GROUP, groupSet.ID, True)
TrackData has some nice methods: trackObject.Deleted - get ids of deleted items, StartMesh/StartGeometry - track all mesh/geomety.
Choose method you prefer
You need to look at the Group Object in the API docs for this one (section 5.31 for Femap Version 11.1 and 11.2). The List method is probably what you need or the GetList method.
Something along the lines of indexing through the ID's in your groupset, then "getting" the group, and then
Set setname feGroup.List(8)
Note that List Type "8" refers to elements.
Also note that this is one of the cases where the API pdf shows an excellent example for the Group Obect ->List method which covers exactly what you need.
In your case, you will probably want to index through a range of element sets as you index through your groupset, so that you create an element set for each group in your group set.
You need to create array of sets to read elements for every group and using List method from group fill every set. Here is an example (sets(i) - array of sets with elements):
Sub Main Dim App As femap.model Set App = feFemap() Dim groupBeforeSet As femap.Set Set groupBeforeSet = App.feSet groupBeforeSet.AddAll(FT_GROUP) 'function that generates groups Dim groupAfterSet As femap.Set Set groupAfterSet = App.feSet groupAfterSet.AddAll(FT_GROUP) groupAfterSet.RemoveSet(groupBeforeSet.ID) Dim groupCount As Long Dim groupIds As Variant 'get group ids groupAfterSet.GetArray(groupCount, groupIds) Dim fgroup As femap.Group Set fgroup = App.feGroup 'create array of sets and define dimension = groupCount Dim sets() As femap.Set ReDim sets(groupCount) 'fill sets with group ids For i = 0 To groupCount -1 fgroup.Get(groupIds(i)) Set sets(i) = fgroup.List(zGroupDataType.FGR_ELEM) Next End Sub
Group data type is FGR_ELEM. so it should be
Set sets(i) = fgroup.List(FGR_ELEM) or Set sets(i) = fgroup.List(8) ...
I get "method or property not found"
I also tried with fgroup.list(zgroupdatatype.FGR_ELEM).
FEMAP help shows it needs to be list(groupdatatype) which is what i have. Am i overlooking something?