iLogic save and replace component

iLogic save and replace component

Anonymous
Not applicable
4,581 Views
7 Replies
Message 1 of 8

iLogic save and replace component

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
4,582 Views
7 Replies
Replies (7)
Message 2 of 8

HermJan.Otterman
Advisor
Advisor
Accepted solution

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
Not applicable

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

0 Likes
Message 4 of 8

HermJan.Otterman
Advisor
Advisor

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


0 Likes
Message 5 of 8

Anonymous
Not applicable

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

0 Likes
Message 6 of 8

marcin_otręba
Advisor
Advisor

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.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 7 of 8

HermJan.Otterman
Advisor
Advisor

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
Not applicable

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.