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 to get the number of Occurrences of component/part in Model

1 REPLY 1
SOLVED
Reply
Message 1 of 2
pts.user1
286 Views, 1 Reply

How to get the number of Occurrences of component/part in Model

Trying to get the number of Occurrences (quantity/ instances) of a component or part from the Model i.e. the number of times the one part is getting used in the model but not getting any API to access it. If anyone can help me resolve this it would be great.

1 REPLY 1
Message 2 of 2
BrianEkins
in reply to: pts.user1

I believe this should work. Use the Design.allComponents property to get all of the components that exist within the assembly.  This basically gives you all of the unique subassemblies and parts but not their quantity.  You can then use these components with the Component.allOccurrencesByComponent method where you pass in the component and it returns all of the occurrences that reference the component. This will give you the number of instances.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report