# Draw blueprints with AI

> How an AI assistant draws technical drawings to scale in Arc-Tech over MCP, with units, shapes, tied dimensions and layers.

Source: https://arc-tech.dev/docs/draw-blueprints

## The steps

1. `create_design` with kind `blueprint`, or `get_blueprint` to read one.
2. Set the unit and scale first, then draw in real lengths. `x` runs right and `y` runs down.
3. `render_design`, and check that dimensions and labels don't sit on top of lines.

## A working example

A sensor node's board, 80 × 50 mm at 1:1, with its mounting holes, its antenna keep-out, and dimensions tied to the board, so they follow it when it changes.

```json edit_blueprint
{
  "design_id": "<design id>",
  "operations": [
    { "op": "set_settings", "unit": "mm", "scale": 1, "title": "Sensor node", "drawing_no": "SN-101" },
    { "op": "add_layer", "id": "board", "name": "Board" },
    { "op": "add_layer", "id": "dims", "name": "Dimensions" },
    { "op": "add", "shapes": [
      { "id": "outline", "type": "rect", "layer": "board", "x": 0, "y": 0, "w": 80, "h": 50, "corner_radius": 4, "weight": "thick" },
      { "type": "circle", "layer": "board", "cx": 5, "cy": 5, "r": 1.6, "weight": "medium" },
      { "type": "circle", "layer": "board", "cx": 75, "cy": 5, "r": 1.6, "weight": "medium" },
      { "type": "circle", "layer": "board", "cx": 5, "cy": 45, "r": 1.6, "weight": "medium" },
      { "type": "circle", "layer": "board", "cx": 75, "cy": 45, "r": 1.6, "weight": "medium" },
      { "type": "rect", "layer": "board", "x": 46, "y": 3, "w": 18, "h": 6, "weight": "thin", "dash": "dashed", "fill": "hatch" },
      { "type": "rect", "layer": "board", "x": 46, "y": 9, "w": 18, "h": 16, "weight": "medium" },
      { "type": "text", "layer": "board", "x": 51, "y": 15.5, "text": "Radio", "size": 2.5 },
      { "type": "dimension", "layer": "dims", "kind": "aligned", "of": { "shape": "outline", "edge": 0 }, "offset": 8, "weight": "thin" },
      { "type": "dimension", "layer": "dims", "kind": "aligned", "of": { "shape": "outline", "edge": 3 }, "offset": 8, "weight": "thin" }
    ] }
  ],
  "reason": "Drew the sensor node's board with its dimensions"
}
```

A rectangle's edges are numbered 0 top, 1 right, 2 bottom and 3 left. An offset's sign chooses the side: here, positive puts the dimension outside the board.

Text sizes and dimension offsets are millimetres on the paper. Everything else is in the sheet's unit. A call takes up to 300 operations.

## Shapes, in full

```text
A blueprint is a technical drawing on a sheet. Geometry is in real lengths, in the sheet's unit at its scale (set
both first, with set_settings: unit mm|cm|m|km|in|ft|yd, scale N for 1:N). x runs right, y down; angles are
degrees, clockwise from +x. Text height and a dimension's offset are mm on the paper (3.5 and 8 are good defaults).
Every shape takes: id (optional; you get it back), layer (id), color ('ink', the paper's ink, by default, or #hex),
weight thin|medium|thick|heavy (ISO pens 0.25/0.35/0.5/0.7: outlines thick, details medium, hatching and dimensions
thin), dash solid|dashed|center|hidden|phantom|dotted (centre lines: center; hidden edges: hidden), locked.
Closed shapes also take fill none|hatch|crosshatch|tint|solid (hatch: a cut section).
Shapes:
  line / arrow: from [x, y], to [x, y]
  rect: x, y, w, h (top-left corner), optional rotation, corner_radius (fillets) or chamfer
  polygon (closed) / polyline (open): points [[x, y], ...], optional corners: a radius for every corner, or a list
    (null, a radius, or {"kind": "chamfer", "size": s, "size2": s2})
  spline: points, closed (a smooth curve through them)
  arc: cx, cy, r, start, end (degrees, drawn clockwise from start to end), or points [start, through, end]
  circle: cx, cy, r; ellipse: cx, cy, rx, ry, rotation
  pen: points (freehand)
  text: x, y (top-left), text (\n for lines), size, rotation, bold
  leader: points (from what it points at, through bends, to the note), text, size
  centermark: of (a circle or arc's id), or cx, cy, r
  dimension: kind aligned|linear|radius|diameter|angle, then either what it's tied to (it follows the shape):
      of {"shape": id, "edge": i}  (aligned or linear: edge i of a rect/polygon/line, 0 = first point to second)
      of {"shape": id}             (radius or diameter of a circle or arc)
      of [{"shape": id, "edge": i}, {"shape": id, "edge": j}]  (angle between two edges)
    or points: aligned/linear [a, b]; radius/diameter [centre, a point on the rim]; angle [vertex, arm, arm].
    offset (paper mm; which side: its sign), axis x|y for linear, label (<> stands for the value).
```

## Operations, in full

```text
operations (applied in order, all saved or none):
  {"op": "set_settings", "unit": "m", "scale": 50, "paper": "whiteprint"|{background, grid, ink},
   "precision": -1 (auto) or decimals, "fraction": 16 (imperial), "angle_format": "decimal"|"dms",
   "show_grid": true, "dimension_arrow": "filled"|"open"|"tick"|"dot", "dimension_text_size": 2.5,
   "title": "...", "author", "date", "sheet", "drawing_no", "checked_by", "show_title_block", "active_layer": id}
   Changing unit or scale keeps the paper as drawn (it relabels lengths); set them before drawing.
  {"op": "add", "shape": {"type": "rect", ...}} or {"op": "add", "shapes": [...]}
  {"op": "update", "id": "...", "changes": {...}}: style keys, text, size, label, offset, layer, and geometry in the
   same keys add takes (from/to, points, x/y/w/h for a rect, cx/cy/r, rx/ry/rotation...)
  {"op": "move", "ids": [...], "dx": 1, "dy": 0}
  {"op": "rotate", "ids": [...], "angle": 90, "about": [x, y]}   (default: the centre of what's turning)
  {"op": "scale", "ids": [...], "factor": 2, "about": [x, y]}
  {"op": "mirror", "ids": [...], "axis": "x"|"y", "about": [x, y]}  (x: flip left-right across a vertical line)
  {"op": "duplicate", "ids": [...], "dx": 5, "dy": 0, "count": 1, "ids_out": ["..."]}  (count copies, each further)
  {"op": "remove", "ids": [...]}
  {"op": "order", "ids": [...], "to": "front"|"back"}
  {"op": "group", "ids": [...], "id": "g1", "mask": false}, {"op": "ungroup", "id": "g1"}
  {"op": "add_layer", "id": "walls", "name": "Walls"}, {"op": "update_layer", "id", "name", "visible", "locked"},
  {"op": "remove_layer", "id": "...", "move_to": "layer-1"}  (without move_to its shapes go too)
```
