Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am trying to export a BOM form an assembly and there are sub-assemblies in the bom. I would like to export the BOM from those sub-assemblies also is there a way to do that?
What I am trying to do is create work orders so for instance; 711-100 has the part 810-100 as well as the assembly 800-100 in it.
I would an exported BOM to list every thing that is in 711-100 (I can do this) and also list the BOM from 800-100.
I would appreciate any nudges or hints it there is a way.
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Solved! Go to Solution.
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Lance_White,
Here is a sample iLogic rule that gets all levels of the BOM. It might not be exactly what you're after, but should get you started.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
'set a reference to the BOM
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM
'set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False
' Make sure that the structured view is enabled.
oBOM.StructuredViewEnabled = True
'set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView
oStructuredBOMView = oBOM.BOMViews.Item("Structured")
' Export the BOM view to an Excel file
oStructuredBOMView.Export ("C:\temp\BOM-StructuredAllLevels.xls", kMicrosoftExcelFormat)
'define Excel Application object
excelApp = CreateObject("Excel.Application")
'set Excel to run visibly
'change to false if you want to run it invisibly
excelApp.Visible = True
'open the workbook
wb = excelApp.Workbooks.Open("C:\temp\BOM-StructuredAll Levels.xls")
'set all of the columns to autofit
excelApp.Columns.AutoFit
'suppress prompts (such as the compatibility checker)
excelApp.DisplayAlerts = false
'save the workbook
wb.Save
''close the workbook, uncomment if you want to close the xls file at the end
''wb.Close

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks alot.
Really like your blog by the way, its been a huge help with learning iLogic.
Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
hi,
it is a good code.But I want to export all part regardless of reference part os sub assembly. it doesn't export "Reference" assembly/ parts.
Kindly advice. I am not a progarmmer. Please add updated code.
regards,
nanda
Inventor 2011
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi nandakumar.hegde,
Here is an updated example that sets the BOM structure of the occurence and the actual file not to be Reference before exporting the BOM.
I see that you have posted to several other existing threads asking the same question. You might want to remove those posts, or reply to them and point future readers to this example (assuming that it provides a solution.)
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
' a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
oCompDef = oDoc.ComponentDefinition
Dim oCompOcc As ComponentOccurrence
'Find all occurrences
For Each oCompOcc In oCompDef.Occurrences
'if component BOM structure is reference then change it to default
If oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then
'set the occurence not to be Reference
oCompOcc.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
'set the file not to be Reference
oCompOcc.Definition.BOMStructure = BOMStructureEnum.kNormalBOMStructure
End If
Next
'set a reference to the BOM
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM
'set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False
' Make sure that the structured view is enabled.
oBOM.StructuredViewEnabled = True
'set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView
oStructuredBOMView = oBOM.BOMViews.Item("Structured")
' Export the BOM view to an Excel file
oStructuredBOMView.Export ("C:\temp\BOM-StructuredAllLevels.xls", kMicrosoftExcelFormat)
'define Excel Application object
excelApp = CreateObject("Excel.Application")
'set Excel to run visibly
'change to false if you want to run it invisibly
excelApp.Visible = True
'open the workbook
wb = excelApp.Workbooks.Open("C:\temp\BOM-StructuredAll Levels.xls")
'set all of the columns to autofit
excelApp.Columns.AutoFit
'suppress prompts (such as the compatibility checker)
excelApp.DisplayAlerts = false
'save the workbook
wb.Save
''close the workbook, uncomment if you want to close the xls file at the end
''wb.Close

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
hello Curtis,
My idea is to export all parts to excel regardless of BOM structure. I tried your code still it doesn't export the reference part to excel. Please find the screen shot.
I tryied Inventor BOM export which does the same. My assembly contain about 10000 part. but excel shows only 8000 parts.
thanks for your suport.
Re: Recurssive BOM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Try parts only BOM View insed of Structured BOM View
oBOM.PartsOnlyViewEnabled = True
oBomview = oBOM.BOMViews.Item("Parts Only")
