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: 

BOM help, objects?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
sstattelman4GLLM
176 Views, 1 Reply

BOM help, objects?

I just have a quick question, is it possible to list a set of bodies within a component in a parts list? If not, is it possible  to make the bodies all into subcomponents and not lose the label and materials I have already set? Thanks in advance.

 

-Sean

1 REPLY 1
Message 2 of 2
goyals
in reply to: sstattelman4GLLM

May be you can try something like this 

app = adsk.core.Application.get()

root  = app.activeProduct.rootComoponent

bodies = adsk.core.ObjectCollection.create()

// child component bodies

for occ in root.allOccurrences:

childComp = occ.component

for body in childComp.bRepBodies:

bodies.add(body)

 

// root component bodies

for body in root.bRepBodies:

bodies.add(body)

 

Now bodies contains all bodies present in part. You need to open the part in Fusion before you try this. There are API available to open the document in Fusion in background passing the dataFile object to it. I hope it helps. Thanks.



Shyam Goyal
Sr. Software Dev. Manager

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