Hi guys,
I created a program to export the Assembly BOM to Excel. I am running into a some strange behaviour regarding Weldments and Inseparable assemblies. Here is a snippet of my code:
'Create BOM Object
Dim oBom As Inventor.BOM
oBom = oAssyDoc.ComponentDefinition.BOM
oBom.StructuredViewEnabled = True
oBom.StructuredViewDelimiter = "."
oBom.StructuredViewFirstLevelOnly = False
'Create BOMView Object
Dim oBomView As Inventor.BOMView
oBomView = oBom.BOMViews.Item(2)
'Create Row Object and run For loop to export
Dim oRow As Inventor.BOMRow
For Each oRow In oBomView.BOMRows
'This is where I put my code to export and write the file.
Next
I run into the issue of the items inside a Weldmant assembly is not being exported. Yet I am able to create a structured multilevel partslist on my drawing showing all the items inside the Weldment.
Whats strange is that even if I change the Weldment assy’s BOM structure to Normal, it still does not make a difference.
Is there a way to get the items of a Weldment into my BOMRows object so that it will export?
Whats starnge is that if an assembly is set to “Inseparable” but is not a weldment then it exports the contents.
Any light on the subject would be appreciated!
Could you please upload the simplest Inventor assembly along with the test code (not snippet) that can reproduce the problem.
Thanks,
Hi I have found the issue.
Further down in my code I was checking if the ComponentDefinitions was of type Assembly. Not knowing that a weldment is not actually classed as an assembly in this case. I have added checking for that as well now and its working now thanks! Here is the code jyst for reference:
If oBOMRow.ComponentDefinitions.Item(1).Type = ObjectTypeEnum.kAssemblyComponentDefinitionObject Or oBOMRow.ComponentDefinitions.Item(1).Type = ObjectTypeEnum.kWeldmentComponentDefinitionObject Then
If oBOMRow.ChildRows.Count > 0 Then
For Each oRow As Inventor.BOMRow In oBOMRow.ChildRows
subGetRowInfo(oRow)
Next
End If
End If
My congratulations!