Message 1 of 3

Not applicable
12-13-2016
09:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hopefully this is easy. I have the exact same logic elsewhere, no problem. It is as if the program is not seeing the open instance of Inventor.
Code:
Imports System.IO Imports System.Runtime.InteropServices Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'Ds_view_partmtl.partmtl' table. You can move, or remove it, as needed. Me.PartmtlTableAdapter.Fill(Me.Ds_view_partmtl.partmtl) End Sub Private Sub cmdRunComp_Click(sender As Object, e As EventArgs) Handles cmdRunComp.Click ' Open BOM In Vantage ' Open BOM in Inventor OpenBOM_Inventor() End Sub Private Function OpenBOM_Inventor() ' Define application Dim oApp As Inventor.Application = GetObject(, "Inventor Application") Dim oDoc As Inventor.AssemblyDocument = oApp.ActiveDocument ' Define Component Definition Dim oDocDef As Inventor.AssemblyComponentDefinition = oDoc.ComponentDefinition ' Define Leaf Occurrences Dim oDocLeaf As Inventor.ComponentOccurrencesEnumerator = oDocDef.Occurrences.AllLeafOccurrences ' Iterate through the Leaf Occurrences and print the name Dim i As Integer = 0 Dim oCompOcc As Inventor.ComponentOccurrence = Nothing For Each oCompOcc In oDocLeaf i += 1 Debug.Print("Occurrence:" + i + ": " + oCompOcc.Name) Next End Function End Class
Pic:
Solved! Go to Solution.