Cancel
Showing results for 
Search instead for 
Did you mean: 

Getting objects in a component.

Builder
Builder

If you have a component, and it set to a reference set called "REAM".

In the reference set there is a body.

How do you get that body from the component, which will be used as a boolean tool.

1 REPLY

Re: Getting objects in a component.

Siemens Phenom Siemens Phenom
Siemens Phenom

Disclaimer:  I have not tested this, but it looks like it should work:


If you have a component, ask for its part with Prototype().

The prototype of a component is a Part.

A Part object has a method called GetAllReferenceSets(), so you can find all of the refsets in your part.

A ReferenceSet object has a Name property, so you can iterate through them until you find the one with the name you are interested in. (See below for another option.)

When you identify the specific ReferenceSet you want, use AskMembersInReferenceSet() to get its contents.

Iterate through the objects returned to see if you have a solid body object.

OR...

You could cycle through the Part using its tag and the name you are interested in and the UF_reference_set_type with UF_OBJ_cycle_by_name_and_type() or its wrapper to get to the refset faster.

Then AskMembersInReferenceSet() to get its contents, and iterate through the objects returned to see if you have a solid body object.