How can I create groups of groups for the geometry in Mechanical?
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
Best Answer
-
Below is a code sample to illustrate how this can be done.
First, create a list of bodies that you would like to group:
bodies = ExtAPI.DataModel.Project.Model.Geometry.GetChildren(DataModelObjectCategory.Body,True) folder1 = ExtAPI.DataModel.Tree.Group(bodies) folder1.Name = "My folder"
Then, to place this group inside another group, the trick is to grab the folder itself and group it:
folder2 = ExtAPI.DataModel.Tree.Group([folder1]) folder2.Name = "My top folder"
Finally, the tree has to be refreshed for the display to update:
ExtAPI.DataModel.Tree.Refresh()
Result is as follows:
0
Answers
-
0