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

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

duke
Enthusiast Enthusiast
1,183 Views
3 Replies
Message 1 of 4

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

duke
Enthusiast
Enthusiast

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.

0 Likes
Accepted solutions (1)
1,184 Views
3 Replies
Replies (3)
Message 2 of 4

gcoombridge
Advisor
Advisor
Accepted solution

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
Contributor
Contributor
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
0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

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
0 Likes