03-02-2017
09:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-02-2017
09:15 PM
Hi Tomas,
Please find the updated code to export BOM in different csv file for each assembly.
Sub Main()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Call ExportDocStructBOM(oDoc)
Dim oSubDoc As Document
For Each oSubDoc In oDoc.AllReferencedDocuments
If oSubDoc.DocumentType = kAssemblyDocumentObject Then
Call ExportDocStructBOM(oSubDoc)
End If
Next
End Sub
Sub ExportDocStructBOM(oDoc As AssemblyDocument)
Dim oBOM As BOM
Set oBOM = oDoc.ComponentDefinition.BOM
oBOM.StructuredViewFirstLevelOnly = False
oBOM.StructuredViewEnabled = True
Dim oStructuredBOMView As BOMView
Set oStructuredBOMView = oBOM.BOMViews.Item("Structured")
oStructuredBOMView.Export "C:\Temp\" & oDoc.DisplayName & "_StructuredBOM.csv", kTextFileCommaDelimitedFormat
End Sub
Please feel free to contact if there is any doubt.
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network
