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: 

Replace part using iLogic

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
632 Views, 3 Replies

Replace part using iLogic

I am new to iLogic. I have an assembly which I want to replace one of the parts with one of four other parts.

 

My code reads:

 

Select Case Width
Case "750"
Component.Replace("part:1", "L:\Drawings\part2", True)
End Select

 

This works fine and when 750 is selected, part1 is replaced with part2.

My problem is then if I want to select "1000" I don't know the part name which I will be replaced by part3 as this could be part1, part2, part4,or part5.


 Thanks

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi,

 

If you have the same order in your assembly, you can create a list of all components and then you can use the item number of this component to get it's name.

 

So you don't say change "Part1:1", you can say Array(0).Name instead.

 

Only as an idea

 

Best Regards

 

Passi

Message 3 of 4
Anonymous
in reply to: Anonymous

Hi, try this:

 

change the name in the browser to a fixed name such as "Base". The refer to this name in your ilogic program. This will ensure that ilogic always finds the same name in the browser. the name will still display correctly on your idw.

 

Hope it helps

Message 4 of 4
Anonymous
in reply to: Anonymous


@Anonymous wrote:

I am new to iLogic. I have an assembly which I want to replace one of the parts with one of four other parts.

 

My code reads:

 

Select Case Width
Case "750"
Component.Replace("part:1", "L:\Drawings\part2", True)
End Select

 

This works fine and when 750 is selected, part1 is replaced with part2.

My problem is then if I want to select "1000" I don't know the part name which I will be replaced by part3 as this could be part1, part2, part4,or part5.


 Thanks


In browser, rename the part name to a common name and use it in your ilogic. For ex.

In browser window, rename Part:1 as X and the rule ll be

 

Select Case Width
Case "750"
Component.Replace("X", "L:\Drawings\part2", True)
End Select

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

Post to forums  

Autodesk Design & Make Report