Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How would I select all components and sub-components?

1 REPLY 1
Reply
Message 1 of 2
i-make-robots
698 Views, 1 Reply

How would I select all components and sub-components?

I have an assembly with many components and sub-components.  I built a selection set of the ones I want to keep visible.  I want to invert selection and hide the rest.  Default "invert selection" doesn't seem to work, no matter what filter options I choose.  I'd like to write a script that does the invert I'm looking for (select all components at all levels of the document tree except those in the original selection set).  Is this straightforward?  In the API reference I see where everything is located in the hierarchy except sub-components. 

Thank you!

1 REPLY 1
Message 2 of 2

 Hi Mr. I-Make-Robots,

 

Components can not be selected only occurrences can.

However, all design's components can be found.

The task you described is not difficult:

- find all occurrences in your design - occLst = rootComponent.allOccurrences 

- for tasks other then selection component list might be useful - compLast = design.allComponents

- iterate through occLst (or compLst) list excluding elements you do not want

- perform the action of your choice on the rest

 

Regards

MichaelT

MichaelT

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report