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: 

Can I use iLogic to give unique occurrence numbers to duplicate components?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
duke
892 Views, 3 Replies

Can I use iLogic to give unique occurrence numbers to duplicate components?

How does Inventor keep track of occurrence numbers for duplicate parts? Can I access this functionality with iLogic?

 

I have an assembly where I add several parts by iLogic. I assign a name to each new part, but also have to name parts that are duplicates. Each duplicate needs a unique occurrence number. I know when I place a component duplicate using the "Place Component" command Inventor automatically iterates the occurrence number. Is there a way to access this ability using iLogic? I want to write a rule that will ensure that component duplicates will always have unique occurrence numbers without having to check every occurrence in the assembly each time.

 

I am able to write rules that can check each component and can iterate the number, but I'd like to use any built in functionality Inventor already has if possible.

Labels (1)
3 REPLIES 3
Message 2 of 4
gcoombridge
in reply to: duke

Leave the occurrence name field in the add component snippet blank with "" and it will automatically choose the next number

Dim componentA = Components.Add("", "Spring.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)
Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
Message 3 of 4
myronHBBUW
in reply to: gcoombridge

this is a great tip. The only problem i experience is that i can't add constraints.
Do you know how to fix that?

Tanks in advance, Myron
Message 4 of 4
A.Acheson
in reply to: myronHBBUW

Hi @myronHBBUW 

 

You can use the occurrence object to identify the occurrence and then reference its name in the constraints. Add the constraints by first manually constraining then using capture snippet to record the constraints through code. Then you can adjust/copy for your occurrence. If you also leave the constraint names blank also they will be sequenced automtically. 

 

Dim  occName as String =  componentA.Name 

If your still having trouble please post the code your using with the questions you have in a new post. It will gain more views and will be solved quicker than working in a solved post. 

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Autodesk Design & Make Report