ajayre
Alibre Super User
A short introduction to adding constraints. This tutorial requires WizoScript 3.50 or later.
First we create a new empty assembly:
Now we load in a part and place it at the origin:
next we duplicate it:
and at this point the two parts are overlaid on top of each other, i.e. occupying the same space.
Now we mate the parts using reference planes for each part:
Some explanation is needed for this function call. The first value '20' is the mate offset in the script units (which default to millimeters). Next we specify the first part to constrain followed by what to constrain. Then we specify the second part and what to constrain for it.
There is an alterative version of this function that allows the mate to be reversed and a name specified for the constraint.
Next we add a align constraint:
This follows the same form as the mate constraint function call.
There are similar functions available to add angle, orient and tangent constraints.
Constraints can be added between the following items:
First we create a new empty assembly:
Code:
Asm = Assembly("Test")
Now we load in a part and place it at the origin:
Code:
NewPart1 = Asm.AddPart(r'C:\Users\Andy\Desktop\PartA.AD_PRT', 0, 0, 0)
next we duplicate it:
Code:
NewPart2 = Asm.DuplicatePart(NewPart1, 0, 0, 0)
and at this point the two parts are overlaid on top of each other, i.e. occupying the same space.
Now we mate the parts using reference planes for each part:
Code:
Asm.AddMateConstraint(20, NewPart1, NewPart1.GetPlane("XY-Plane"), NewPart2, NewPart2.GetPlane("XY-Plane"))
Some explanation is needed for this function call. The first value '20' is the mate offset in the script units (which default to millimeters). Next we specify the first part to constrain followed by what to constrain. Then we specify the second part and what to constrain for it.
There is an alterative version of this function that allows the mate to be reversed and a name specified for the constraint.
Next we add a align constraint:
Code:
Asm.AddAlignConstraint(5, NewPart1, NewPart1.GetPlane("YZ-Plane"), NewPart2, NewPart2.GetPlane("YZ-Plane"))
This follows the same form as the mate constraint function call.
There are similar functions available to add angle, orient and tangent constraints.
Constraints can be added between the following items:
- Axes
- Edges
- Faces
- Planes
- Points
- Vertices