add_sketch_dimension
Add a driving dimension to a sketch entity at a specified point. Automatically names the dimension, enabling parametric modification and linking to global variables.
Instructions
Cota de croquis — agrega una dimensión gobernante (driving dimension) a la entidad de croquis que pasa por el punto (x, y, z) dado. La cota queda nombrada automáticamente "D1@Croquis1", "D2@Croquis1", etc.
Uso típico CSWA: tras dibujar el outline del Tool Block con create_line/create_arc, agregar cotas a los segmentos clave (A=largo total, B=alto total) para luego ligarlas a variables globales y parametrizar el diseño.
[en: Sketch dimension — add a driving dimension to the sketch entity that lies at the given point. Auto-named "D1@", "D2@...", etc. Used to make a sketch parametric so its dimensions can be modified in-place (vía modify_dimension) or linked to a global variable.]
Args: entity_x_mm, entity_y_mm, entity_z_mm: A point in the part frame (mm) that lies ON the sketch entity to dimension (e.g., the midpoint of a sketch line, or a point on a sketch circle's perimeter). SW selects the closest sketch segment to this point. value_mm: The desired dimension value, in millimeters. SW first creates the dim with the entity's current geometric value, then this tool overrides it to value_mm (forcing the geometry to update). text_offset_x_mm, text_offset_y_mm: Where to place the dim text, as an offset from the entity point in mm. Cosmetic only; defaults to (20, 10) for legible callouts.
Returns: the dim's full name (e.g., "D1@Croquis1"), suitable for use
with modify_dimension(sketch_name, "D1", new_value_mm) or for
binding to a global variable via an equation.
Requires the sketch to be in EDIT MODE — call right after create_sketch / create_sketch_on_face and BEFORE the sketch is closed by extrude_sketch / extrude_cut.
Gotcha: SW infers the dim TYPE from what was selected (line→length, circle→diameter, two lines→angle). If you pass a point that lies on a circle's perimeter, you get a diameter dim. To force a specific type, ensure your entity_point is clearly inside one entity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value_mm | Yes | ||
| entity_x_mm | Yes | ||
| entity_y_mm | Yes | ||
| entity_z_mm | No | ||
| text_offset_x_mm | No | ||
| text_offset_y_mm | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |