Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use an ACTConsole Snippet to get solid bodies in a geometry group? 1

Status
Not open for further replies.

tlewis3348

Mechanical
Aug 23, 2017
31
I normally group all the solid bodies representing bolts in a model together into a single geometry group. I would like to use a ACTConsole Snippet to get a list of all the bolts in that group. Is that possible? I am currently using this to get the groups in the model:

Code:
ExtAPI.DataModel.Project.Model.GetChildren(DataModelObjectCategory.TreeGroupingFolder,True)

Looping through that, I can identify the group I want by getting the group with the "Geometry" as the parent and "bolt" in the name. However, I don't know how to get the children of the group. I think the documentation here might potentially be able to help me, but I don't really know what I'm looking at. Can anyone here point me in the direction I need to go?
 
Replies continue below

Recommended for you

Python:
groups = ExtAPI.DataModel.Project.Model.Geometry.GetChildren(DataModelObjectCategory.TreeGroupingFolder,True) 

bolt_group = groups[0]

if "Bolt" in bolt_group.Name:
	bolts = bolt_group.Children
 
Code:
groups = ExtAPI.DataModel.Project.Model.Geometry.GetChildren(DataModelObjectCategory.TreeGroupingFolder,True) 

bolt_groups = [group for group in groups if "Bolt" in group.Name]
bolt_group = bolt_groups[0]

bolt_parts = bolt_group.Children

bolt_bodies = [part.Children[0] for part in bolt_parts]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor