08-12-2016
08:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-12-2016
08:02 AM
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