BOM.ExportBOMCustomization - Suspected Bug - Code Included
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
The above method does not produce an XML with the correct BOM columns for all three BOM views. Please try the following for simple reproduction of this error.
1) Create a new assembly.
2) Alter the BOM columns for the 'Structured' view (for instance, add a non-standard property such as 'Filename' as a column).
3) Run the below iLogic rule.
4) Check the exported XML file called 'TestExport.xml' in your temp directory.
5) Note that the column format does not represent your saved format (see screenshot below)
6) Note also that a manually exported BOM customization file (using UI) WILL be correctly formatted. See screenshot below.
Autodesk please reproduce error using my code and assist if possible.
Many thanks,
Luke
SyntaxEditor Code Snippet
Dim oDoc As AssemblyDocument = ThisApplication.ActiveEditDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oMgr As RepresentationsManager = oDef.RepresentationsManager ThisApplication.SilentOperation = True Dim InitialLOD As String = oMgr.ActiveLevelOfDetailRepresentation.Name ' Check current LOD - if it is not 'Master' then the structured BOM can't be accessed... If Not InitialLOD = "Master" Then ' Switch to master LOD oMgr.LevelOfDetailRepresentations("Master").Activate(True) End If ThisApplication.SilentOperation = False 'set a reference to the BOM Dim oBOM As BOM = oDoc.ComponentDefinition.BOM ' Export BOM customization Dim TempXMLName As String = System.IO.Path.GetTempPath & "TestExport" & ".xml" If System.IO.File.Exists(TempXMLName) Then System.IO.File.Delete(TempXMLName) End If ' Get the structured BOM view Dim oBOMView As BOMView = oBOM.BOMViews.Item(2) oDoc.Rebuild() oBOM.ExportBOMCustomization(TempXMLName)