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
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-engineering-drawing-d202e085b7c2 ,按照其中的说明把「engineering-drawing」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Provenance: maintained in earthtojake/text-to-cad. Use the installed local skill files as the runtime source of truth.
An engineering drawing is a DOCUMENT derived from a part. cadgen.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. $dxf makes cut layouts and flat
patterns, which are toolpaths, not documents; the two are different jobs.
Get the part. cadgen.read_step(Path(__file__).parent / "../STEP/part.step")
reads the artifact a @step model wrote (run python <model>.py first); a
live build123d shape works just as well. The drawing documents geometry, it
does not build it.
Write <name>_drawing.py beside the model, from
the 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.
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.
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).
Run python <name>_drawing.py. It prints the PDF it wrote, and anything
it noticed while drawing — read those first:
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.
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.
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).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.The script raises rather than writing a wrong or missing document:
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=.out= missing or not naming a .pdf, at import time.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.