constraints.VerticalConstraint
constraints.VerticalConstraint(point1, point2, *, weight=1.0)
Constraint that forces two sketch points onto a vertical line.
This constraint enforces: x1 = x2 (in sketch-plane coordinates).
Reduces DOF by 1 (one scalar equation).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| point1 | Vector2 | First sketch point (Vector2 parameter) | required |
| point2 | Vector2 | Second sketch point (Vector2 parameter) | required |
Example
p1 = Vector2([0, 0], free=True, name='p1')
p2 = Vector2([1, 2], free=True, name='p2')
constraint = VerticalConstraint(p1, p2)
Methods
| Name | Description |
|---|---|
| compute_residual | Compute vertical constraint residual: x1 - x2. |
| dof_reduction | Vertical constraint adds 1 scalar equation. |
| get_parameters | Return both points involved in the vertical constraint. |
compute_residual
constraints.VerticalConstraint.compute_residual(param_values)
Compute vertical constraint residual: x1 - x2.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| param_values | dict[str, Array] | Dict with keys matching parameter names | required |
Returns
| Name | Type | Description |
|---|---|---|
| Array | Scalar residual (0 when constraint is satisfied) |
dof_reduction
constraints.VerticalConstraint.dof_reduction()
Vertical constraint adds 1 scalar equation.
get_parameters
constraints.VerticalConstraint.get_parameters()
Return both points involved in the vertical constraint.