Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Inserting the same part multiple times with the same constraints

Odalv
Contributor

Inserting the same part multiple times with the same constraints

Odalv
Contributor
Contributor

Hello!
I have a part that I need to insert into the assembly multiple times. Every time I insert this part, I need to make two constraints: the Z axis (Mate) and the XY plane (Flush).

Basically, I need to insert multiple occurrences of the same part, but with the same two constraints. The other constraints are different and I cannot use pattern.

I have found relatively simple code for constraining one instance of this part. But it will not work if I insert the same part multiple times because of the "occurence" number (marked with red) beside the part name.


Constraints.AddMate("Mate:1", "PartA:1", "Z Axis", "", "Z Axis",)
Constraints.AddFlush("Flush:1", "PartA:1", "XY Plane", "", "XY Plane")


I have tried to use only "" instead of part name, but that didn't work.

Would it be possible to use iLogic to automate this process?

0 Likes
Reply
Accepted solutions (1)
314 Views
2 Replies
Replies (2)

Cadkunde.nl
Collaborator
Collaborator
Accepted solution

Try using for/next statement

 

For i = 1 To 10
	Constraints.AddMate("Mate:" & i, "PartA:" & i, "Z Axis", "", "Z Axis",)
	Constraints.AddFlush("Flush:" & i, "PartA:" & i, "XY Plane", "", "XY Plane")
Next
0 Likes

Odalv
Contributor
Contributor

Brilliant! That was exactly what I need! 

Many thanks!

0 Likes