add_sketch_relation
Add a geometric constraint like horizontal, vertical, coincident, tangent, equal, or fix to sketch segments to make the sketch fully defined.
Instructions
Relación de croquis — agrega una restricción geométrica (horizontal, vertical, coincident, tangent, equal, fix) a uno o dos segmentos del croquis activo. ESTA es la pieza que faltaba para que un croquis quede TOTALMENTE DEFINIDO y no "nade" 1-2 mm cuando SolidWorks resuelve sus relaciones automáticas.
Uso típico CSWA: tras dibujar el outline con create_line/create_arc, fija las aristas planas con 'horizontal'/'vertical' y combínalas con add_sketch_dimension (cotas gobernantes) hasta que el croquis se vuelva negro (totalmente definido). Así A/B/C quedan paramétricas y un cambio es una sola llamada a modify_dimension — sin reconstruir desde cero.
[en: Sketch relation — add a geometric constraint (horizontal/vertical/ coincident/tangent/equal/fix) to one or two segments of the active sketch. This is what makes a sketch FULLY DEFINED so it stops drifting 1-2 mm under SW's auto-relations.]
Args: relation: one of "horizontal", "vertical", "coincident", "tangent", "equal", "fix". horizontal/vertical/fix take 1 point; coincident/ tangent/equal take 2. entity_points_mm: list of [x, y] (or [x, y, z]) points in mm, each lying ON a target sketch segment (the closest segment is picked).
Returns {relation, constraint, sketch_name, points}.
Requires the sketch in EDIT mode (call after the geometry, before extrude_sketch closes it). No rebuild — locked in on the next exit.
Related: add_sketch_dimension (driving cotas); add_sketch_fillet / add_sketch_chamfer (corner geometry).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| relation | Yes | ||
| entity_points_mm | Yes |