Assembly |
Creating Constraints on Published Elements |
![]() |
This macro shows you how to create constraints on published elements. This macro opens the CAAAsmCstOnPublish.CATProduct
document that contains two parts: a plate, Plate.CATPart, and two
instances of a screw, Screw.CATPart. It retrieves on each Product
object the Publication
objects corresponding to published elements identifying for example the
position of the holes in the plate and the axis of the screws. It creates Constraint
objects to position those elements regarding one another. It then uses the
|
|||||
![]() |
CAAAsmCstOnPublish is launched in CATIA [1]. No open document is needed. CAAAsmCstOnPublish.CATScript is located in the CAAScdArrUseCases module. Execute macro (Windows only).
|
|||||
![]() |
CAAAsmCstOnPublish includes the following steps: PrologThe macro first loads CAAAsmCstOnPublish.CATProduct that contains two Part: Plate.CATPart and Screw.CATPart for which two instances have been created: Screw.1 and Screw.2. Those objects use the Publication capability of CATIA V5 to expose some of their elements using a stable name. The plate published as "Top" its top face and as "Hole1" and "Hole2" the center points of the two holes. The screw publishes as "HeadBottom" the bottom face of its head and as "Axis" its axis.
Once the new product document has been loaded, the Other variables, Creating Constraints
The Publication object corresponding to the top surface of the
plate is fetched in the Publications collection of tthe Using those 2 references an offset constraint is created using the The Three other constraints are created the same way: offset between the top face of the plate and the bottom face of the second screw and coincidence between the axis of each screw and the center of the corresponding home of the plate.
The Root Product is then updated to move the parts in a position respecting the contraints to newly created constraint giving the following result.
A message box is displayed allowing to see the intermediary result before going on. On Unix the result will only be visible at the end of the macro. Replacing the Screw by Another Screw
The All constraints on published elements are automatically reconnected and updating the Root Product automatically positions the new instances in the assembly: |
[Top]
This use case has shown how to create and use constraints on published elements using macros.
[Top]
[1] | Replaying a Macro |
[2] | Product, Publication, Constraint, Products, CatConstraintType, CatConstraintOrientation |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.