- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I thought this one would be easy but is causing me some trouble. I have several BOM configurations that I need to export out of inventor. Right now I import the xml. file to get the configuration I want then check it before exporting the file. Is there a way to import the xml. file using iLogic?
My plan is to have the different BOM configurations set up as external rules and using a global form I can click on whatever BOM configurations I need to use. This way I just open the BOM and it’s ready to view or export.
I tried to change some code I found on here but just not getting me anywhere (code below). I would appreciate any help you might be able to give.
Sub BOM_ColumnCustomizasion_Export ()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oAsmDoc.ComponentDefinition
Dim oBOM As BOM
Set oBOM = oAsmDef.BOM
Dim filename As String
filename = "c:\temp\BOM_Columns.xml"
Call oBOM.ExportBOMCustomization(filename)
Beep
End Sub
Sub BOM_ColumnCustomizasion_Import ()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oAsmDoc.ComponentDefinition
Dim oBOM As BOM
Set oBOM = oAsmDef.BOM
Dim filename As String 'assume the file exists
filename = "c:\temp\BOM_Columns.xml"
Call oBOM.ImportBOMCustomization(filename)
Beep
End Sub
thanks
JD
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition Dim oBOM As BOM = oAsmDef.BOM Dim filename As String = "Fullfilename of the xml" Call oBOM.importBOMCustomization(filename)
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to open the BOM on the structure tab when this rule has been run?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The BOM is allways opened at the tab that was activated when closing the BOM editor.
Maybe in the reg editor there is some option to do this?
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It doesn’t have to open on that tab. I just want to be able to use the code below and want it to open the BOM to view with the same rule.
SyntaxEditor Code Snippet
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition Dim oBOM As BOM = oAsmDef.BOM Dim filename As String = "P:\Engineering\Inventor\BOM List\Profit Key BOM.xml" Call oBOM.importBOMCustomization(filename)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Then this is what you need
'Open BOM editor dialog box
Dim oCtrlDef As ControlDefinition
oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyBillOfMaterialsCmd")
oCtrlDef.ExecuteIf you want to print all commandnames, there is a snippet in de vba help that does this, very helpfull and i have this file all the time with me ![]()
Sub PrintCommandNames()
Dim oControlDefs As ControlDefinitions
Set oControlDefs = ThisApplication.CommandManager.ControlDefinitions
Dim oControlDef As ControlDefinition
Open "C:\temp\CommandNames.txt" For Output As #1
Print #1, Tab(10); "Command Name"; Tab(75); "Description"; vbNewLine
For Each oControlDef In oControlDefs
Print #1, oControlDef.InternalName; Tab(55); oControlDef.DescriptionText
Next
Close #1
End Sub
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you so much for your help. I’m still having a little trouble. Below is the code I’m using in visual basic for a button command. It is not understanding “Thisapplication” command. Frederic you code worked great when run in a rule. I just can get it to work in the application I’m trying to make. I would appreciate if you could look this code over to see what I’m doing wrong. I know that it’s close.
Thank you
SyntaxEditor Code Snippet
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If _invApp.Documents.Count = 0 Then MsgBox("Need to open an Assembly document") Return End If If _invApp.ActiveDocument.DocumentType <> _ DocumentTypeEnum.kAssemblyDocumentObject Then MsgBox("Need to have an Assembly document active") Return End If Dim asmDoc As AssemblyDocument asmDoc = _invApp.ActiveDocument Dim oAsmDoc As AssemblyDocument = _invApp.ActiveDocument Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition Dim oBOM As BOM = oAsmDef.BOM Dim filename As String = "P:\Engineering\Inventor\BOM List\Profit Key BOM.xml" Call oBOM.ImportBOMCustomization(filename) 'Open BOM editor dialog box Dim oCtrlDef As ControlDefinition oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyBillOfMaterialsCmd") oCtrlDef.Execute() End Sub
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Thisapplication works in vba & illogic, just replace it with your _invApp and it will work if you _invApp is properly declared
please feel free to "kudos"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you. I know it was something simple that I was over looking. Thanks again for your help.