Provide command parameters using PostPrivateEvent

<?xml encoding=”UTF-8″>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:temptest.ipt")
Dim cd As ControlDefinition
Set cd = cm.ControlDefinitions("AssemblyPlaceComponentCmd")
Call cd.Execute
End Sub

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading