Message 1 of 5

Not applicable
08-22-2019
02:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear,
I want to create a rule in an Inventor assembly drawing with a Parts list (BOM view - structured) with following functions:
- Create a new Excel file in the path of the project (no problem to find path)
- Export the BOM of the assembly drawing to this new Excel file
-> this doesn't work I don't know how
- Pick a standard template to export this BOM and choose the starting cell. (As you can do manually - but how in iLogic?)
The export function doesn't seem to work with me...
Dim pathProject As String Dim pathExcelFile As String Dim nameExcel As String Dim WO As String pathProject = ThisDoc.WorkspacePath() pathExcelFile = pathProject + "\Doc\" 'WO are the number left of this seperator '-' Dim Separators() As Char = {"-"} Sentence = iProperties.Value("Project", "Part Number") Words = Sentence.Split(Separators) WO = Words(0) Parameter.UpdateAfterChange = True iLogicVb.UpdateWhenDone = True nameExcel = WO + "-stuklijst.xls" 'Filename van Excel aanmaken (openen of nieuw) myXLS_File = pathExcelFile + nameExcel oDoc = ThisDoc.ModelDocument If oDoc.DocumentType = kPartDocumentObject Then MessageBox.Show("You need to be in an Assembly to create BOM", "Noassembly") Return End If oDoc = ThisApplication.ActiveDocument Dim oBOM As BOM 'THIS LINE BELOW GIVES A DECLARATION FAULT.. HELP oBOM = oDoc.ComponentDefinition.BOM 'STRUCTURED BoM oBOM.StructuredViewFirstLevelOnly = False oBOM.StructuredViewEnabled = True Dim oStructuredBOMView As BOMView 'HERE ALSO A DECLARATION FAULT oStructuredBOMView = ThisBOM.BOMViews.Item("Structured") 'Export BOM view naar Excel file oStructuredBOMView.Export(myXLS_File, kMicrosoftExcelFormat)
Solved! Go to Solution.