Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic Save & replace?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
e2000773
296 Views, 2 Replies

Automatic Save & replace?

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.

2 REPLIES 2
Message 2 of 3
A.Acheson
in reply to: e2000773

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.

Syntax

CommandManager.PostPrivateEventDataType As PrivateEventTypeEnumData 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. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 3
e2000773
in reply to: A.Acheson

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report