- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can someone please get me started here?
I have a iLogic rule that I need to run in visual studio 2022 so i can step through with debug and solve problems with new Inventor 2022 model states. I can figure it out as soon as I get a program that can run but I don't know where to start. I have a new project made and ready for code but I don't understand how to import the Inventor name space and whatever else I need.
For example, here is what the code begins with now:
Sub Main
'Get current document
Dim doc = ThisDoc.Document
Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition
'MessageBox.Show("debug")
doc.Rebuild()
'Get the BOM object
Dim oBOM As BOM = oAssyDef.BOM
'enable the Parts Only View
oBOM.PartsOnlyViewEnabled = True
'Get the Parts Only view of the BOM
Dim oBOMViewPO As BOMView = oBOM.BOMViews.Item("Parts Only")
'declare variable for each BOM row.
Dim oBOMRowPO As BOMRow
'For each row in the Parts Only BOM, do the following
For Each oBOMRowPO In oBOMViewPO.BOMRows
'do some stuff
Next
' Get the active project
Dim oProject As DesignProject = ThisApplication.DesignProjectManager.ActiveDesignProject
Looks like I will need to change "ThisDoc" to specify the Inventor app but thats where I'm stuck.
Here is what I have so far in VB, I just don't know how to add the reference so I can call the Inventor objects.
Public Class Form1
Sub Main()
End Sub
Private Sub btnRun_Click(sender As Object, e As EventArgs) Handles btnRun.Click
Main()
End Sub
End Class
Thank you!
Solved! Go to Solution.