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: 

iLogic save and replace component

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
4085 Views, 7 Replies

iLogic save and replace component

Is there any ilogic code for the save and replace component button in Productivity?

 

 

src.png

 

I want to place a hinge assembly into an assembly then replace that hinge assembly with a new filename.

7 REPLIES 7
Message 2 of 8
HermJan.Otterman
in reply to: Anonymous

Hello,

 

Look at this link

http://modthemachine.typepad.com/my_weblog/2009/03/running-commands-using-the-api.html

 

 

The command name to use is : "AssemblyBonusTools_SaveAndReplaceComponentCmd"

 

put this in a iLogic rule:

 

    ' 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

 

It will start the command, now you have to select and name the part..

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 3 of 8
Anonymous
in reply to: Anonymous

The code working good to select parts in assembly or and sub assembly but, does someone know if it's possible to select an assembly with the save and replace by using a simililar Ilogic

Message 4 of 8
HermJan.Otterman
in reply to: Anonymous

not sure what you mean?

 

where should the assembly be selected from?

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 5 of 8
Anonymous
in reply to: HermJan.Otterman

I mean select a sub assembly in the main assembly to save and replace.

If we select a sub assembly in tree and then click on command save and replace, the command let us save and repplace the sub.

But if we call the command first the only choice the command give is to select parts, no sub

Message 6 of 8
marcin_otręba
in reply to: Anonymous

Actually, if you saveas using:

 

doc.SaveAs newname,  False

 

then if file is member of assembly, and that assembly is opened then it is replaced without any further functions or procedures... it works for *.ipt, and*.iam files.

 

if you dont want to replace use:

 

doc.SaveAs newname,  True

 

true/false means that you saveascopy or not.

Message 7 of 8
HermJan.Otterman
in reply to: Anonymous

In the graphic window, you can select parts, but in the Browser you can select an sub assembly...

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 8 of 8
Anonymous
in reply to: HermJan.Otterman

This snippet of code works flawlessly. The only downside is I have to manually select the parts. Is there a possibility to select several parts in the code to execute the save and replace function for?

I've been searching all over the internet but there's little to be found regarding de Save and replace function.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report