- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I'm creating an addin for Inventor and I'm currently stuck at placing/inserting a component into my assembly.
I quickly figured out how to add a component in iLogic with:
Dim componentA = Components.Add("a:1", "a.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)
I would like to convert this into vb.net for my addin. I found some documentation about IManagedComponents, but can't figure out how to initialize the managedComponents. I tried doing it like this, but it's not working:
Imports Autodesk.iLogic.Interfaces
Imports Inventor
Module BuildConveyor
Dim managedComps As IManagedComponents
Public Sub PlaceComponent(ByVal m_inventorApplication As Inventor.Application)
Try
Dim oOcc = managedComps.Add("", "S1325-03-000-00.iam", , , , )
Catch ex As Exception
MsgBox($"Error placing component: {ex.Message}")
End Try
End Sub
End ModuleI get the error:
Error placing component: Object reference not set to an instance of an object.
I'm assuming something's missing after the Dim managedComps As IManagedComponents, maybe something like managedComps = m_inventorApplication.ActiveDocument.Component
I don't know.
If anyone has any idea how to make it work, I'd greatly appreciate it.
Thanks.
Solved! Go to Solution.