Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Traverse Assembly And Output BOM File Including Attributes

isocam
Collaborator

Traverse Assembly And Output BOM File Including Attributes

isocam
Collaborator
Collaborator

Can anybody help???

 

I have the following Python code to set several different attributes in a Fusion 360 part document.....

 

def SetPartType(PartType):
app = adsk.core.Application.get()

selectedComponent = adsk.fusion.Design.cast(app.activeProduct).rootComponent

compAttributes = selectedComponent.attributes

newAttribute = compAttributes.add('PartAttributes', 'Part: Type', PartType)

 

In this case, for example, I can set the "Part: Type" attribute to "Laser Cut Profile".

 

I can read a parts attributes using the following Python code....

 

def GetPartType():
app = adsk.core.Application.get()

selectedComponent = adsk.fusion.Design.cast(app.activeProduct).rootComponent

compAttributes = selectedComponent.attributes

readAttribute = compAttributes.itemByName('PartAttributes', 'Part: Type')

PartType = readAttribute.value

return PartType

 

Does anybody know how to traverse through an assembly and export the parts list to a (ascii) text file that includes the part attribute (in this case Laser Cut Profile.

 

I need to export, for each part, the following information....

 

Part: Number

Part: Description

Part: Quantity

Part: Attribute

 

For example,

 

Part Number: 0001

Part Description: Bearing Housing

Part Quantity: 12

Part Type: Laser Cut Profile

 

Many thanks in advance!!!

 

Darren

0 Likes
Reply
159 Views
0 Replies
Replies (0)