BOM help, objects?

sstattelman4GLLM
Advocate

BOM help, objects?

sstattelman4GLLM
Advocate
Advocate

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

0 Likes
Reply
Accepted solutions (1)
281 Views
1 Reply
Reply (1)

goyals
Autodesk
Autodesk
Accepted solution

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
1 Like