# Aligning with RPS

This task shows you how to align a cloud of points with a reference with RPS.
This command is mainly intended for parts digitized using RPS.

## Differences between aligning with constraints and aligning with RPS

Similarly to alignment with constraints, RPS alignment is defined by a set of constraints.
The differences between these two alignment commands are:

 Align with RPS Align with Constraints A well-defined RPS alignment must always be isostatic, to insure the repeatability of alignment conditions. Non-isostatic system is accepted. Constraints are defined only by points, circles and arcs. Constraints can also be defined by planes, cylinders and spheres. When a circle or an arc is input, its center position, i.e. a point, is taken into account When a circle or an arc is input, its center axis, i.e. a line,  is taken into account Only translations can be frozen. Translations and rotations can be frozen. For each RPS constraint, at least one axis must be frozen. In a point - point constraint, you can freeze one, two or three axes of the point on the reference. In a point - point constraint, all the three axes (X, Y and Z) of the point on the reference are automatically frozen.

## Definition of a RPS Alignment

Since a RPS alignment is isostatic, the following conditions must be satisfied:

• In a first axis, three RPS constraints must be frozen to define a plane.
• In a second axis, two RPS constraints must be frozen to define a line.
• In a third axis, one RPS constraint must be frozen to define the locating point.

Defining a RPS alignment requires a minimum of 3 RPS constraints and a maximum of 6 RPS constraints.

In some situations, Align with RPS leads to multiple solutions which are often symmetrical and
the solution proposed by the command may be different from the one you expect.
This happens particularly if the reference is too far away or too rotated from the Cloud to Align.
In such cases, we recommend that you first carry out a rough alignment using the compass.
Open the AlignConstraint2.CATPart model from the samples directory.
You are going to align CloudToAlign.1 in Example.1 on the Reference.1 in CADModel.1

1. Select the Geometrical Set where you want to create the output cloud, if any, and select Define In Work Object.

2. Click Align with RPS in the Reposit toolbar.
The Align with RPS  dialog box appears.

3. Select the Cloud to Align (we have selected CloudToAlign.1 in Example.1). The Cloud to Align can be a cloud of points or a mesh.
is available to hide or show the Cloud to Align
Once the Cloud to Align is selected, the button Add becomes available.

4. Define a first constraint:

 Click Add. Select the point RPS Mesh.1 on the Cloud to Align then the point RPS Ref.1 on the reference. The dialog box is updated. Both points are highlighted in red. In the dialog box, place your cursor on the line of this constraint and click under X, Y, Z to freeze those axes. If needed, click again on X, Y or Z to unfreeze an axis.The light is still yellow meaning there is not enough constraints to define the RPS alignment.
5. Define a second constraint with points RPS Mesh.2 and RPS Ref.2 and frozen axes X and Y
then a third constraint with points RPS Mesh.6 and RPS Ref.6 and frozen axis Y.

 The colors of the constraint elements picked change: A color is associated to each couple of constraint elements that define a constraint, The point selected on the Cloud to Align is displayed as a dot, The point selected on the reference is displayed as a cross, Another color is associated to the next couple of constraint elements, etc
6. The light has turned green, meaning that the RPS alignment is correctly defined.

 The light is yellow when there are too few or too many constraints to define the RPS alignment, i.e. the alignment is not fully defined. The light is green when the RPS alignment is fully defined and the alignment result is isostatic. The light is red when the RPS alignment is fully defined but the alignment result is not isostatic.
7. By default, the Keep Initial check box is selected:
 the initial Cloud to Align is kept as such, a copy of this initial Cloud to Align is made and appears in the specification tree, this copy is aligned with the References. Clear this check box if you do not want to create a copy of the initial Cloud to Align, e.g. because of its size. The initial Cloud to Align itself will be aligned with the References. To avoid inconsistencies, you cannot clear the Keep Initial check box in the following two cases: when the geometry of the Cloud to Align is shared by other cloud elements, e.g. when the Cloud to Align shares points or vertices with another cloud without any parent/child relationship between them. Clearing the Keep Initial check box would move the other cloud together with the Cloud to Align, which you do not want to. when the Cloud to Align is a feature, e.g. a GSD transformation feature.

8. Click Apply to start the alignment.

9. The Cloud to Align is moved towards the reference.

10. Click More to display the Statistics.

Alignment #1 indicates this is the first computation you have launched since you have opened the dialog box,
For each constraint (e.g. RPS1) is given:
 the name of the constraint elements selected  RPS Mesh.1/RPS Ref.1 the distance (X: -2.13163e-014) between the constraint element on the Cloud to Align and the constraint element on the reference along the frozen axes. not frozen means that the corresponding axis is not frozen.

11. Once you are satisfied, click OK to validate and exit the dialog box.

12.  If Keep Initial is selected: A new cloud, in fact the copy of the initial Cloud to Align (CloudToAlign.2 in our example), is created in the specification tree, and aligned with the reference, the new cloud has the same graphic properties than the initial Cloud to Align, the initial Cloud to Align is hidden.  If Keep Initial is not selected: The Cloud to Align is aligned with the References and no new cloud is created in the specification tree. In both cases, an Axis Systems is created with:: AxisTrs.x (system axis computed on the Cloud to Align) and  AxisRef.x (axis system created on the output cloud). Those Axis Systems can be used with the Axis to Axis action on other elements to align. Align with previous transformation is also available.