Export Assembly Bom item number to a custom i property. only works in structure Bom (Needs to work with all parts only Bom)

Export Assembly Bom item number to a custom i property. only works in structure Bom (Needs to work with all parts only Bom)

estewart3E8B6
Enthusiast Enthusiast
274 Views
1 Reply
Message 1 of 2

Export Assembly Bom item number to a custom i property. only works in structure Bom (Needs to work with all parts only Bom)

estewart3E8B6
Enthusiast
Enthusiast
Can some make this work for all parts Not just structured parts (I need this to work with content center parts also.
thank you,

Dim app As Inventor.Application = ThisApplication Dim doc As AssemblyDocument = app.ActiveDocument Dim compDef As AssemblyComponentDefinition = doc.ComponentDefinition Dim oRow As BOMRow For Each oRow In compDef.BOM.BOMViews(2).BOMRows '2 runs on the structured BOM ... may try 1 or 3 if you don't get the desired results For i = 1 To oRow.ComponentDefinitions.count iProperties.Value(oRow.ComponentDefinitions(i).Document.DisplayName, "Custom", "Item#") = oRow.ItemNumber Next Next

 

0 Likes
275 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

You could create a larger loop around your first For Each loop that counts from 1 through 3 and puts that variable in place of 2 for specifying which BOMView you're working with.  However, it would probably just overwrite the same iProperty multiple times, because some of the same components are likely present in each view.  As for this working with Content Center parts too...I don't think that will work, because Content Center parts will most likely be ReadOnly (like a Library).

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes