Send BOM contents to Listbox...

Anonymous

Send BOM contents to Listbox...

Anonymous
Not applicable

Good Morning Everyone

 

I am busy creating a custom BOM Plotter for our company. I am struggling to get it to work. In my application i get the selected main assembly's file path.

 

What i need to do next is get all the BOM Items in the main assembly and send them to a Listbox with each one's file path.

 

I Then need to get each file's IDW in the list box. And then use the print option. (Which i will figure out myself.


Any help will be appreciated

 

Example Code below

 

Public Class Form1

    Dim _invApp As Inventor.Application
    Dim _started As Boolean = False

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ToolStripStatusLabel2.Text = ""
        Dim workfolder As String = "C:\Inventor Workfolder\Projects\"
        OpenFileDialog1.InitialDirectory = workfolder
        OpenFileDialog1.ShowDialog()
        ToolStripStatusLabel2.Text = OpenFileDialog1.FileName
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim m_inventorApp As Inventor.Application = Nothing
        ' Try to get an active instance of Inventor
        Try
            m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
        Catch ex As Exception
        End Try

        If m_inventorApp Is Nothing Then
            Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application")
            m_inventorApp = System.Activator.CreateInstance(inventorAppType)
        End If

        Dim oDoc As AssemblyDocument
        Dim oBOM As BOM

        oDoc = m_inventorApp.ActiveDocument

        Dim oAsmDocMasterLOD As AssemblyDocument
        oAsmDocMasterLOD = m_inventorApp.Documents.Open(ToolStripStatusLabel2.Text, False)

        oBOM = oAsmDocMasterLOD.ComponentDefinition.BOM

        oBOM.StructuredViewFirstLevelOnly = True

        oBOM.StructuredViewEnabled = True






    End Sub
0 Likes
Reply
235 Views
0 Replies
Replies (0)