Engineering Drawing

earthtojake/text-to-cad

Generate dimensioned PDF engineering drawings from part geometry, with projected views, hole callouts and a title block.

Contenuto aggiornato: SKILL.md
Punteggio di qualità 90/100
npx skills add earthtojake/text-to-cad --skill engineering-drawing --copy
26.122Stelle2482ForkUltimo push del repository

Informazioni sullo Skill

A Python drawing script projects a part onto ISO sheets and adds measured dimensions, hidden lines, centre marks, hole callouts and notes. Update the model and rerun the drawing to update the PDF. This workflow produces a shop document; DXF cutting layouts have a separate Skill.

SKILL.md

Autore: earthtojake · earthtojake/text-to-cad · MIT · SKILL.md @ f08344f

---
name: engineering-drawing
description: Make an engineering drawing of a part as a PDF - orthographic views with hidden lines and centre marks, real dimensions, hole callouts, notes and a title block on ISO sheets, all projected from the part's geometry so the drawing follows the model. Use when the user asks for a drawing, a dimensioned sheet, shop or manufacturing drawings, a print, or "2D views of this part". Not for DXF cut layouts or flat patterns.
license: MIT
metadata:
  repository: earthtojake/text-to-cad
---

# Engineering drawing

An engineering drawing is a DOCUMENT derived from a part. `cad.eng_drawing`
projects views from the part's geometry, places dimensions between points ON
that geometry, finds centre marks on it, and lays the result out on an ISO
sheet with a frame and a title block. Change the model, rerun the drawing
script, and the views, hidden lines and measured values move with it. Nothing
on the sheet is drawn by hand, and nothing on it is a number you typed unless
you chose to override a value.

**The output is one PDF.** That is what a shop receives and what every
operating system opens. No DXF is written, nothing is paired or linked, and
there is no CLI: the script is the interface. Cut layouts and flat patterns are
toolpaths, not documents, and a different job.

## Setup

Run the `cad` command (`~/.local/bin/cad` where it is not on your PATH; `cad.exe` on Windows). If
it is missing, install text-to-cad, outside a sandbox or with its permission:

```bash
curl -fsSL https://texttocad.dev/install.sh | sh
```

On Windows, in PowerShell: `irm https://www.texttocad.dev/install.ps1 | iex`. If the CAD app was
only just added, its server may still be starting: try again for up to a minute first. `cad doctor
--check` explains any other failure, changing nothing; `cad doctor` repairs what it reports. Tell the
person any next step `cad setup` prints.

## Workflow

1. Get the part. Call the model: `enclosure()`, imported from the model's script,
   is built by text-to-cad's server (a replay when the server already holds it), and
   its `.shape` is the part. For a part with no model, read its file: `step.read` for a
   STEP, `xbf.read` for an xbf, anchored on `Path(__file__).parent`. Any build123d
   shape works. The drawing documents geometry, it does not build it.
2. Write `<name>_drawing.py` beside the model, from
   [the template](references/sheet-api.md#template). Import the model facts the
   dimensions reference (hole pitch, overall size, wall) from the model module
   rather than retyping them, so moving a feature moves its dimension.
3. Place views with `sheet.three_views(part, iso=True)`, which returns FOUR
   views: top, front and right in third angle with room for two rows of
   dimensions, plus an isometric in the free corner. `sheet.three_views(part)`
   returns three. Use `sheet.view(part, name, at=(x, y))` (sheet millimetres
   from the bottom-left corner; A3 is 420 × 297, A4 is 297 × 210) only for a
   custom layout.
4. Dimension what a maker needs, in MODEL coordinates: overall size per view
   (`view.overall()`), feature positions and sizes (`view.dim`, with `tol=`
   or `fit=` where the design requires one), holes as callouts (`view.hole`:
   thru, depth, counterbore, countersink, thread), and notes with leaders
   (`view.note`). Leave `text` unset so the dimension is measured; give a
   value only where the model does not define it. Leave `offset` unset too and
   the dimension takes the next free row outside the view; pass one only to
   place a dimension deliberately, and remember it is measured from the
   dimension's own points, not the view's edge. Keep notes few and short; one
   wider than the sheet's note column is refused, and `notes=` takes a LIST
   (`notes="BREAK EDGES"` is a sequence of eleven characters, so it is refused
   too).
5. Run `cad run <name>_drawing.py`. It prints the PDF it wrote, and **anything
   it noticed while drawing** — read those first:
   - *"measures blank paper"*: the dimension's model points do not land on the
     view's geometry. Almost always the part was built from a corner and the
     script assumed it was centred. Check the part's bounding box.
   - *"annotation overlaps"*: two callouts print on top of each other, usually
     one view's outermost dimension against the label of the view above it.
     Pass a bigger `three_views(gap=...)` or place one with `offset=`. The text
     is measured as the renderer draws it, glyph by glyph, so this fires on ink
     and not on markup: a chain of toleranced dimensions is silent when the
     values clear each other.

   Steps 3 and 5 stand on their own: a sheet of views with no dimensions on it
   yet is a drawing, and writes its PDF.

   When running unattended, set `MPLCONFIGDIR` to a writable directory so
   matplotlib's font cache does not warn.
6. **Read the PDF** and fix what collides. Check that no dimension text sits on
   a view, that hidden lines appear where features are behind faces, that every
   hole has a centre mark, and that no leader crosses the part. Very small
   dimensions (a few mm) put their value on their own extension line; dimension
   the larger feature instead. Move `at=` or `offset=` and rerun.

## What the sheet contains

- Layers with meaning: `VISIBLE` (heavy outline), `HIDDEN` (dashed), `CENTER`
  (centre marks), `DIM`, `NOTES`, `TITLE`, `SHEET` (frame), each printed at its
  own weight — 0.5 mm down to 0.18 mm, so thick reads against thin on paper.
  An edge is drawn once: a silhouette that the kernel returns as both visible
  and hidden stays on `VISIBLE`. Hidden TANGENT transitions are not drawn at
  all — a fillet running into a face, or the seam where a cylinder closes on
  itself, marks nothing a shop can see, and drawn dashed it reads as a hidden
  edge that is not there (on a bore, as a line down the hole's own axis).
- Dimensions measured from the geometry, with filled arrowheads and witness
  lines, and true-size values at any drawing scale.
- A title block with title, part number, material, author, scale, units,
  projection, revision, `SHEET n OF m` and the drawing function's name;
  numbered notes above it (the general tolerance, when given, is note 1);
  a revision table top-right when `revisions=` is given. Text longer than
  its cell is set smaller, and cut with an ellipsis rather than overrun.
- PDF bytes that are a function of the content: no creation date is stamped, so
  an unchanged drawing rebuilds to an identical file.

## What fails loudly

The script raises rather than writing a wrong or missing document:

- Views that run off the frame, naming a scale that has been laid out and
  verified to fit, or saying that no standard scale does.
- A part argument the vocabulary does not define: an unknown view name, sheet
  size or projection, `orientation=` other than `"h"`/`"v"`, a negative or zero
  diameter, a counterbore that is not a `(diameter, depth)` pair, a `tol` that
  is not a number or a pair, a hole that is both `thru` and given a depth,
  `notes=` or `revisions=` given a bare string, a note wider than the sheet,
  `angle()` legs that are collinear or zero-length, a non-finite `at=` or
  `offset=`.
- A missing renderer. The PDF is the drawing, so no matplotlib is a failure,
  not a skipped half. A failed render leaves no file
  it wrote; an earlier PDF stays byte for byte.
- `out=` missing or not naming a `.pdf`, at import time.

## Limits to state in the handoff

- Tolerances come only from `tol=`, `fit=` and `general_tolerance=` that you
  write; get the values from the design requirements or the user, never
  invented. A dimension without one is nominal.
- Views are orthographic projections with hidden lines from the kernel; no
  sections, details, or auxiliary views yet. Say what a view does not show.
- The sheet keeps callouts clear of the views it knows about, and reports
  annotation that still prints over other annotation, but it does not check
  annotation against line work. Read the PDF.

Perché lo abbiamo scelto

Useful when a shop needs a drawing that follows the model. Dimensions are measured from geometry, and the workflow requires reviewing the actual PDF.

A cosa serve

  • Prepare a dimensioned part drawing as a readable manufacturing PDF.

How to use this Skill

  1. Load the actual part

    Use saved STEP geometry or the model shape and identify the dimensions and tolerances a maker needs.

  2. Lay out the sheet

    Create projected views, measured dimensions, hole callouts and the title block in a drawing script.

  3. Render and read the PDF

    Run the drawing script, inspect warnings, then read the PDF and fix overlapping annotations or missing views.

Official Engineering Drawing workflow

Try a first task

  1. Send a concrete brief

    Provide the real input files and replace example dimensions or machine details with your own.

    Create an A4 PDF drawing for this STEP bracket with front, top, right and isometric views, overall dimensions and through-hole callouts. Use only the supplied tolerances.

Official Engineering Drawing workflow

Install this Skill

Run the command below from your project directory. Keep the Skill folder and its bundled references and scripts together.

This workflow also requires the text-to-cad cad command. The upstream setup at https://github.com/earthtojake/text-to-cad/blob/2738524be8b30ec3d025d73b499fd2a6028af336/docs/install.md configures additional Skills and plugins in supported agents.

ComandoA cosa serve
npx skills add earthtojake/text-to-cad --skill engineering-drawing --copyInstall this Skill in your project and select your agent.

Official installation and update instructions

Scope and limits

The documented workflow has no section, detail or auxiliary views. A nominal dimension does not imply a tolerance.

Official Engineering Drawing workflow

Install

  1. Claude Code

    From your project directory, install this skill.

    npx skills add earthtojake/text-to-cad --skill engineering-drawing -a claude-code --copy
  2. Codex

    From your project directory, install this skill.

    npx skills add earthtojake/text-to-cad --skill engineering-drawing -a codex --copy
  3. Cursor

    From your project directory, install this skill.

    npx skills add earthtojake/text-to-cad --skill engineering-drawing -a cursor --copy
  4. Manual copy

    Copy this folder from the repository into the project skills directory for your agent: skills/engineering-drawing. Claude Code: .claude/skills/; Codex and Cursor: .agents/skills/. Keep the entire folder including SKILL.md and its supporting files.

  5. Install the full pack

    On macOS or Linux, run the author’s installer to set up text-to-cad across detected agent apps and register the cad command.

    curl -fsSL https://texttocad.dev/install.sh | sh
  6. Install the full pack

    On Windows, run the author’s PowerShell installer to set up text-to-cad across detected agent apps and register the cad command.

    irm https://www.texttocad.dev/install.ps1 | iex

Prima di usarlo

  • Needs uv, the pinned cadgen runtime, its PDF renderer, and a STEP part or build123d geometry. Supply the design tolerances instead of asking the agent to invent them.

Agenti supportati

Claude CodeCodex CLICursorGemini CLIGrok Build

Domande frequenti

Do I install this as a separate product?

This is one task in the shared text-to-cad library. Use the official plugin or the complete Skill installation, then select this workflow for the task.

Is the Skill free?

The upstream code is MIT-licensed. Your agent provider, hardware, materials and any fabrication service can have separate costs.

Fonti e riferimenti

Le fonti originali sono collegate qui sotto. Gli spunti pratici sono suggerimenti editoriali di SkillHey.