So I found this code floating in this forum:
' Get the CommandManager object.
Dim oCommandMgr As CommandManager oCommandMgr = ThisApplication.CommandManager
' Get control definition for the line command.
Dim oControlDef As ControlDefinition oControlDef = oCommandMgr.ControlDefinitions.Item( _ "AssemblyBonusTools_SaveAndReplaceComponentCmd")
' Execute the command.
oControlDef.Execute
This code essentially is the Save & Replace feature in Inventor and makes you manually choose the placed part. I was wondering if it's possible to make it automatic everytime I place a part in assembly without me selecting the placed part from the assembly tree? If that is not possible then the next best thing would be to include the file name in the code and it would be custom to every part I have. Like the part name is for an example: part-1123.ipt and in the code it is determined to find part in assembly with that name -> save and replace. Any ideas? The important thing is to preserve the ability to rename it and have a custom save directory.
So when I place a part in assembly my form pops up and there is the rule integrated to the form as a button. Pressing that does the save and replace.
Solved! Go to Solution.
Solved by e2000773. Go to Solution.
Solved by A.Acheson. Go to Solution.
Hi @e2000773
To work with the save and replace command through command manager you will need to use post private event and the filename event type enumerator see API help here.
SyntaxCommandManager.PostPrivateEvent( DataType As PrivateEventTypeEnum, Data As Variant )
This will pass a fullfilepath to the dilaogue much the same as if you pasted the path there manually. It will suppress the dialog so you either make a dialog to browse for a location or supply a constant path.
Thanks, but I found a correct solution here: Solved: iLogic code for saving and replacing a part in assembly file - Autodesk Community - Inventor
Can't find what you're looking for? Ask the community or share your knowledge.