Create sketch
sketch_createCreates a complete 2D sketch in a KOMPAS document in one call, optionally parametric with constraints and driving dimensions, or adds geometry to an existing sketch for later edits.
Instructions
Create a whole sketch in ONE call (it is never left open in edit mode), optionally parametric: constraints and DRIVING dimensions whose variables change the sketch later (feature_edit(obj=sketch, params={var: value}) or tie them to part variables with expr). into=obj:sketch adds entities/constraints/dimensions to an existing sketch. inspect_model(obj=sketch) reads its geometry, dimensions and constraint state. Returns a receipt: created object handles, volume/mass before and after, backup path. The whole call is ONE Ctrl+Z for the user; if verification fails the model is restored and VERIFY_FAILED is returned.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc": "<doc>"
},
"name": "sketch_create"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | Document handle from doc_list/doc_open, e.g. 'doc:12001:0a1b2c3d' | |
| into | No | obj: of an existing sketch to add to | |
| name | No | Meaningful feature name for the tree, e.g. 'Отв_крепёжные_6xD11' | |
| plane | No | XY (front) | ZX (top) | ZY (left) | obj: plane | topo: planar face (ignored with into) | XY |
| entities | No | Geometry in the sketch's own 2D coordinates, mm/deg, each with an optional id (default e0, e1… by position): {type:'line',x1,y1,x2,y2,axis?} | {type:'rect',x,y,w,h} (sides .0 bottom .1 right .2 top .3 left) | {type:'circle',xc,yc,r} | {type:'arc',xc,yc,r,a1,a2,ccw?} | {type:'polyline',points:[[x,y],...],closed?} (side .k from point k). Contours for extrusion/revolve must be closed; draw a stepped profile as ONE closed polyline (adjacent regions sharing a segment are rejected by KOMPAS). For revolve the profile lies on one side of the axis. | |
| dimensions | No | Driving dimensions, value = as drawn: {type:'length', of:'line'} | {type:'horizontal'|'vertical', a:'point', b:'point'} | {type:'diameter'|'radius', of:'circle/arc'}; optional var (name of the sketch variable; default L1, X1, Y1, D1, R1…), expr (e.g. a part variable name made by variables_set), offset (mm from the geometry). | |
| parametric | No | parametric sketch (default): joins of sides, horizontal/vertical, and — for rectangles, circles and arcs nobody dimensioned — driving dimensions (L1, D1, R1…) and a fixed anchor point, so simple sketches come out fully defined and their sizes are editable variables. false = bare geometry | |
| constraints | No | {type, a, b?}: horizontal|vertical (a line) | parallel|perpendicular|equal_length|collinear (two lines) | equal_radius|concentric|tangent (two curves) | coincident (two points) | fix (a point) | point_on (a point, a curve). References: 'id', 'id.k' (side k), points 'id:start'|'id.k:end'|'circle:center'. Joins of rect/polyline sides and horizontal/vertical of axis-parallel lines are added automatically in a parametric sketch. |