By Adam Nagy
You can execute Inventor commands by calling Execute/Execute2 on their ControlDefinition.
Sometimes you may also want to avoid the dialog that the command brings up to get input.
Many commands support taking the input provided by PostPrivateEvent, so that the input dialog will not appear.
Here is a small VBA sample that shows how to do this, e.g. running the "Place" command inside an assembly document:
Sub TestPlace() Dim cm As CommandManager Set cm = ThisApplication.CommandManager Call cm.PostPrivateEvent(kFileNameEvent, "C:\temp\test.ipt") Dim cd As ControlDefinition Set cd = cm.ControlDefinitions("AssemblyPlaceComponentCmd") Call cd.Execute End Sub