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: 

How to add the same component multiple times using ilogic

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
tgrenierJA998
852 Views, 2 Replies

How to add the same component multiple times using ilogic

Hi, I will try to make this as clear as possible. Basically, I want to be able to be able to add the same component multiple times in an assembly using ilogic. When done manually with "place" command, if Inventor recognizes the same part/component being added more than once it adds ":2" at the end of its name, then ":3" and so on.

 

So here is my issue, I can add parts/components to assemblies, however, whenever I add the same one, because it has the same name as a previously added part/component, then it deletes the initial one in order to place the new one.

 

How can I tell ilogic that if I have the same part/component already in an assembly to simple add the ":2" or ":3" and so on?

 

Here is an example of what I do to add a new component:

Dim ComponentA = Components.Add("partA", "partA.ipt", position := pointA, grounded := True, visible := True, appearance := Nothing)

Note : this is all part of an "if" "then" statement so it may happen that "partA" appears again because the excel spreadsheet I use to determine which part to add satisfies that statement.

 

Thank you in advance for your help

2 REPLIES 2
Message 2 of 3
andrewiv
in reply to: tgrenierJA998

Try this code, this will insert the component and name it as if it were inserted manually.

Dim ComponentA = Components.Add("", "partA.ipt", position := pointA, grounded := True, visible := True, appearance := Nothing)

Andrew In’t Veld
Designer

Message 3 of 3
tgrenierJA998
in reply to: andrewiv

I can't believe it was so simple!

 

Thank you so much and have a great day!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report