edit_drawing
Edit CAD drawing entities, layers, and text locally while preserving the original file; each change creates a new working-copy version with atomic operations and undo/reset support.
Instructions
Edit a drawing locally (no calls, except 1 the first time to fetch the drawing as IR). Every edit is saved as a new version of the working copy; the original file is never changed. Returns the counts changed, the IDs and real lengths of added entities, and the version.
ops: a list of operations, applied all or nothing: {"op": "set", "ids": [...] or "where": {"layer"|"kind"|"text": ...}, "fields": {...}} fields: layer, color (0-256 or "#RRGGBB"), linetype, lineweight_mm, or the kind's geometry and text fields (p1, p2, center, radius, insert, height, text...). {"op": "delete", "ids": [...]} or with "where" {"op": "replace_text", "pattern": "old", "replacement": "new", "where": {...}?, "regex": false} {"op": "add_layer", "name": "walls", "color": 5} {"op": "add", "entities": [{"kind": "LINE", "layer": "walls", "p1": [0, 0], "p2": [36.4, 0]}]} kinds: LINE, CIRCLE, ARC, POINT, LWPOLYLINE, TEXT, MTEXT. Coordinates are drawing units (see inspect_drawing; for Jw_cad, millimetres on paper). To pick by area, get IDs with query_drawing first. No geometric operations (move, copy, offset): compute new coordinates and use set or add. create: start a blank drawing at path (which must not exist): {"format": "jww" or "dxf", "paper": "A3", "scale": "1/100", "layers": ["walls", "text"]} undo: go back one version. reset: discard the working copy (start again from the file).
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": {
"path": "<path>"
},
"name": "edit_drawing"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | No | ||
| path | Yes | ||
| undo | No | ||
| reset | No | ||
| create | No |