By Luke Davenport
A quick one today:
Using an iLogic rule to automatically run the ‘Place Component’ command in Inventor – with options…..
I was aware that you can invoke the ‘Place’ command (and many others) using the CommandManager in an iLogic rule. The code below will run the place command, using a file called ‘STORMTROOPER.IPT’, located on my C drive. The only issue with this method is that the messagebox afterwards will be shown before you’ve finished placing the component(s). In other words, the code will not wait for you to finish placing.
' Inform the command manager which file you are about to place using iLogic
ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, "C:\CAD WIP\STORMTROOPER.ipt")
' Run the 'Place' command - rule will continue to run in the background while you are placing....
MsgBox("Continuing to run iLogic rule in background....", 64, "Cadline iLogic")
It’d be nice to optionally have the iLogic rule wait until you’ve placed all the instances of this component you require before it continues running. And thanks to Adam Nagy at Autodesk’s insight here we can do just that.
Please download the document below to view the code.
Check out the video below to see both methods in action…
Note: thanks to Sean Lavallee on GrabCAD for the Star Wars model!