Automated technical-drawing generation for build123d
Project description
draftwright
Automated technical-drawing generation for build123d. Point it at a solid (or a STEP file) and get a fully-annotated multi-view engineering drawing — orthographic views, dimensions, section A–A, ISO hatching, title block — ready to export as SVG and DXF.
from build123d import Box, Cylinder, Pos
from draftwright import make_drawing
part = Box(80, 60, 20) - Pos(0, 0, 5) * Cylinder(8, 20)
make_drawing(part, out="my_part", title="Mounting Block", number="DWG-001")
# writes my_part.svg and my_part.dxf
Or from the command line:
draftwright my_part.step --title "Mounting Block" --number DWG-001
What it produces
- Three orthographic views (front, plan, side) sized and scaled automatically to the page
- Dimensions on every principal envelope face, plus bore callouts (diameter, depth, counterbore, spotface) on all holes
- Section A–A with ISO 128-44 solid filled cutting-plane arrows and ISO 128-50 45° hatching on the cut face, triggered automatically when blind or stepped holes would otherwise be hidden-line-only
- Title block (ISO 7200) with part name, drawing number, scale, tolerance, and date
- Lint —
Drawing.lint()checks annotation coverage, page bounds, and ISO compliance and returns structuredLintIssueobjects
All output is real build123d geometry, so SVG and DXF export come from the same source and dimensions are live on the DXF layer.
Installation
pip install draftwright
Requires Python ≥ 3.10 and build123d ≥ 0.9.0. Annotation primitives are provided by
build123d-drafting-helpers,
which is installed automatically as a dependency.
Usage
From a build123d solid
from draftwright import make_drawing, build_drawing, Drawing
# One-shot: write SVG + DXF
make_drawing(part, out="drawing", title="My Part", number="DWG-001")
# Composable: get a Drawing object to inspect or extend
dwg = build_drawing(part, title="My Part")
issues = dwg.lint() # list[LintIssue]
dwg.export_svg("drawing.svg")
dwg.export_dxf("drawing.dxf")
From a STEP file
from draftwright import make_drawing
make_drawing(step_file="part.step", out="drawing")
Or via the CLI:
draftwright part.step --out drawing --scale 2 --page A3
draftwright part.step --script # write an editable .py drawing script instead
Scale and page control
from draftwright import choose_scale
# Auto-select the best ISO/ASME standard scale for an A3 sheet
scale, page_w, page_h, n_steps = choose_scale(80, 60, 20, page="A3")
# Override
make_drawing(part, out="drawing", scale=2.0, page="A2")
Lint and coverage
from draftwright import build_drawing, lint_feature_coverage
dwg = build_drawing(part)
issues = dwg.lint() # geometry lint + feature-coverage check
for i in issues:
print(i.severity, i.message)
Architecture
draftwright is a single module (make_drawing.py) on top of two Apache 2.0 libraries:
draftwright (AGPL-3.0)
└── build123d-drafting-helpers (Apache 2.0) — Dimension, Leader, HoleCallout, …
└── build123d (Apache 2.0) — CAD kernel
The engine handles view layout (strip/zone model), scale selection, feature recognition
(holes, bosses, bolt circles), annotation placement, and section view generation.
Annotation primitives (Dimension, Leader, lint_drawing, etc.) live in
build123d-drafting-helpers and can be used independently.
License
draftwright is licensed under the GNU Affero General Public License v3 (AGPL-3.0).
This means:
- You can use, modify, and distribute it freely in open-source projects
- If you run draftwright as part of a network service (e.g. an API that generates drawings), you must make your application's source code available to users
For commercial use without these obligations, contact pzfreo@gmail.com.
The annotation primitives in
build123d-drafting-helpers
are Apache 2.0 and may be embedded in commercial applications without restriction.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file draftwright-0.1.2.tar.gz.
File metadata
- Download URL: draftwright-0.1.2.tar.gz
- Upload date:
- Size: 180.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cb65bd59ea33f9a8cfb26ebeeb57af41c3f5f40f1b79e13e89ceb6987543c8e
|
|
| MD5 |
fea8fc7fb4b98eb5b2c68f451f92be10
|
|
| BLAKE2b-256 |
e14e40af502a079b20fced82afed2a435ea7a8fd00f94841ed6d095a290aa5d2
|
Provenance
The following attestation bundles were made for draftwright-0.1.2.tar.gz:
Publisher:
publish.yml on pzfreo/draftwright
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
draftwright-0.1.2.tar.gz -
Subject digest:
1cb65bd59ea33f9a8cfb26ebeeb57af41c3f5f40f1b79e13e89ceb6987543c8e - Sigstore transparency entry: 1818684197
- Sigstore integration time:
-
Permalink:
pzfreo/draftwright@90f013bcf316d64b6e84ab767e357eea7e725ef2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pzfreo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90f013bcf316d64b6e84ab767e357eea7e725ef2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file draftwright-0.1.2-py3-none-any.whl.
File metadata
- Download URL: draftwright-0.1.2-py3-none-any.whl
- Upload date:
- Size: 68.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fce4c8c40f0ee13c8b6ddf459c192eb49c3a68daa19f31feb386bef23e4a8cc4
|
|
| MD5 |
03dca1a4f23c9724457af1e8db585969
|
|
| BLAKE2b-256 |
6d9ac692c89df7c73dcf587a61f9c87cb654a7077ffb132ca5744e9bc86d65e7
|
Provenance
The following attestation bundles were made for draftwright-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on pzfreo/draftwright
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
draftwright-0.1.2-py3-none-any.whl -
Subject digest:
fce4c8c40f0ee13c8b6ddf459c192eb49c3a68daa19f31feb386bef23e4a8cc4 - Sigstore transparency entry: 1818684205
- Sigstore integration time:
-
Permalink:
pzfreo/draftwright@90f013bcf316d64b6e84ab767e357eea7e725ef2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pzfreo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90f013bcf316d64b6e84ab767e357eea7e725ef2 -
Trigger Event:
release
-
Statement type: