Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get part number of a BOMRow with all instances supressed

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
jgaston
315 Views, 2 Replies

Get part number of a BOMRow with all instances supressed

jgaston
Participant
Participant

Inventor 2022 introduced the suppress component feature in the State Master.

 

How can I get the properties of the BOMRow if there is no component definition?

 

I mean, if I can't access the component definition, how do I get the Part Number, for example?

0 Likes

Get part number of a BOMRow with all instances supressed

Inventor 2022 introduced the suppress component feature in the State Master.

 

How can I get the properties of the BOMRow if there is no component definition?

 

I mean, if I can't access the component definition, how do I get the Part Number, for example?

Labels (2)
2 REPLIES 2
Message 2 of 3
dalton98
in reply to: jgaston

dalton98
Collaborator
Collaborator
Accepted solution

Hello. You will have to open the document in the background in order to view that info. How I understand it: Every file that is referenced in your current assembly is technically open but you cant see it. You can check this with "ThisApplication.Documents.Count"

 

Use something like this to get the part number of suppressed parts from the bom

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
Dim oBOMView As BOMView = oBOM.BOMViews.Item(1)
For Each oRow As BOMRow In oBOMView.BOMRows
	If oRow.ComponentOccurrences.Count = 0
		filename = oRow.ReferencedFileDescriptor.FullFileName
		Dim oDoc As Document
		oDoc = ThisApplication.Documents.Open(filename, False)
		partnumber = oDoc.PropertySets.Item(3).Item("Part Number").Value
		MessageBox.Show(partnumber)
		oDoc.Close
	End If
Next

 

 

Hello. You will have to open the document in the background in order to view that info. How I understand it: Every file that is referenced in your current assembly is technically open but you cant see it. You can check this with "ThisApplication.Documents.Count"

 

Use something like this to get the part number of suppressed parts from the bom

Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
Dim oBOMView As BOMView = oBOM.BOMViews.Item(1)
For Each oRow As BOMRow In oBOMView.BOMRows
	If oRow.ComponentOccurrences.Count = 0
		filename = oRow.ReferencedFileDescriptor.FullFileName
		Dim oDoc As Document
		oDoc = ThisApplication.Documents.Open(filename, False)
		partnumber = oDoc.PropertySets.Item(3).Item("Part Number").Value
		MessageBox.Show(partnumber)
		oDoc.Close
	End If
Next

 

 

Message 3 of 3
jgaston
in reply to: dalton98

jgaston
Participant
Participant

Thank you very much, Dalton.

 

I was hoping there was an alternative that would not force me to open the file, but al least, there is a roundaraound!

0 Likes

Thank you very much, Dalton.

 

I was hoping there was an alternative that would not force me to open the file, but al least, there is a roundaraound!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report