Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
meck
in reply to: A.Acheson

Hi All,

Sorry for those that have been reading this thread. I was pulled from this project for a while, but I'm back on it again.

I hope I can clear up the confusion from previous post.

Please reference the attached image file...

With the BOM open if I click on item 84, it highlights 3 parts in the browser. In this case parts 42C8943H02 with the occurrence numbers :55, :56, :57. If I click on item 85 the same 3 parts in the browser will be highlighted. Their part numbers will change to 42C8943H01, but the occurrence numbers are the same :55, :56, :57.

What I want to do is traverse the BOM and get the occurrence number of the part in each row. If I can get that I can then compare that number with other numbers in the BOM and then set their item numbers to the same value. In the example Item 85 would become item 84 so that both 42C8943H01 and 42C8943H02 would have the same item number.

I’ve been tinkering with Inventor’s BOM sample  but I cannot get the occurrence number from the row object in the BOM.

 

For i = 1 To oBOMRows.Count
' Get the current row.
Dim oRow As Inventor.BOMRow
oRow = oBOMRows.Item(i)

'Set a reference to the primary ComponentDefinition of the row
Dim oCompDef As Inventor.ComponentDefinition
oCompDef = oRow.ComponentDefinitions.Item(1)

Dim occurrence As Inventor.ComponentOccurrence
occurrence = oCompDef.Occurrences(1) <<<<<<<This fails if it is only a parts file, and returns subcomponents if it is a sub assembly

Next

 

I sure hope this helps clear this up, because I am stumped.

Thanks All!

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018