Skip to main content

specify-pmi

Add manufacturing intent to a STEP part, and write it as AP242 semantic PMI.

specify-pmi reads a STEP part, recognises its features (holes with their counterbores and threads, hole patterns, slots, bosses, fillets and turned bodies) and works out what a manufacturer still needs to know: the material, datums, fits, thread classes, hole positions, surface finish and the general tolerance. It asks a question for each gap, with a suggested default and the reason for it. Your answers are written back into the STEP as AP242 semantic PMI (GD&T that CAD and inspection tools can read), and the file is read back to verify it.

It is deterministic: rules and standards tables, no AI. The answers are stored in the file too, so a later revision of the part can be opened and carried on with.

  • No dependencies: no OpenCascade, build123d or quiddity. The engine is Rust, in one wheel.
  • Wheels for Linux (x86_64, aarch64), macOS (Apple silicon, Intel) and Windows, for CPython 3.11 and later.
  • Apache-2.0.

It is the engine behind Draftwright Specify, which adds a 3D review of the same questions in the browser.

Install

pip install specify-pmi

Python

from specify_pmi import api

analysis = api.analyse("plate.step")         # features, faces and any existing PMI

for q in api.questions(analysis, {}):         # what is still unknown
    print(q.id, "|", q.prompt, "| default:", q.default)

# An edit list: fill gaps, change what the file states, remove by number, decide none,
# accept suggestions. Ids are the feature table's (analysis["table"]["rows"]).
edits = {"fill": {"part.material": "6082-T6", "hole.function:holes:9": "fit:H7"},
         "accept_suggestions": ["part.general_tolerance"]}
report = api.write("plate.step", edits, "plate-pmi.step")   # all or nothing

print(report.written)       # ['material 6082-T6', 'Ø8 H7 on holes:9', ...]
print(report.retired)       # characteristic numbers a change or a remove retired

A list is applied all or nothing: if any entry cannot be applied, nothing is written and EditsRefused (a ValueError, from specify_pmi.writer) names every failing entry in its failures. api.check_edits(step, edits) checks a list without writing.

Write reports optionally include geometry_carrier_exemptions ({part, condition, aspect, feature}), preserved_normalizations ({id, normalization}), presentation_warnings (strings), retained_shared (ids of support Replace kept for PMI it cannot read) and saved_view_findings ({kind, part, ids, entity, detail} findings about the default Notes saved view). to_dict() omits empty lists. The v0.4.8 kernel preserves original entity text during Add, including when adding a separate datum feature on a kept carrier. Add upgrades requiring source repairs raise a clear RuntimeError naming the entities and repair; Specify never retries with Replace.

Opening the written file again picks up where you left off: the file is the only copy (its PMI, read into api.analyse(...)["table"], and the decisions that left no PMI, in ["resume"]["answers"]).

The main functions, all in specify_pmi.api:

Function What it does
parts(step) Lists an assembly's parts.
load(path, part=None) Reads a file once; pass the returned LoadedPart to the others instead of a path.
analyse(step, part=None) Recognises features and reads existing PMI. Returns the analysis (a dict).
questions(analysis, answers) The questions, given the answers so far (Question objects).
apply(analysis, answers, accept_defaults=False) Turns answers into the intent to write. Raises IncompleteError naming what is still missing, unless defaults are accepted.
preview(analysis, answers) The intent the answers so far would give, without requiring every answer.
write(step, edits, output) Applies an edit list to the file, all or nothing, and verifies it. Returns a WriteReport.
check_edits(step, edits) Checks an edit list as write would apply it; writes nothing.
write_parts(step, intents, output) The same for several parts of an assembly, in one file.
mesh(step, part=None, *, max_deviation_mm=None) Triangles grouped by face index, for showing the part and picking faces.

Answers are a dict of question id to value, e.g. {"part.material": "6082-T6"}. Requirements no question asked for (a flatness, a fit, a finish on faces you choose) are added as extra.* answers.

Command line

specify-pmi analyse plate.step -o plate.analysis.json
specify-pmi questions plate.analysis.json --open                # unanswered questions, as JSON
echo '{"fill":{"part.material":"6082-T6"},"accept_suggestions":["part.general_tolerance"]}' > edits.json
specify-pmi write plate.step edits.json -o plate-pmi.step

specify-pmi parts lists an assembly's parts. Pass --part INDEX to write the edit list to one of them. specify-pmi mesh writes the face-indexed triangles.

For a host program

specify-pmi serve answers JSON requests, one per line, on stdin and stdout. Each request carries everything it needs, so a restarted process loses nothing. This is how an application drives it as a child process:

{"id": 1, "op": "analyse", "step": "/path/part.step"}
{"id": 2, "op": "questions", "analysis": {...}, "answers": {...}}

Each reply is {"id", "ok": true, "result"} or {"id", "ok": false, "error": {"code", "message"}}, where the code is incomplete (with what is missing), invalid or failed. analyse replies with the analysis and the mesh. For edit-list writes use the CLI command above or the Python write function. The serve protocol retains its intent-based write request for existing clients. analyse accepts optional "max_deviation_mm": 0.05 for its mesh. It must be a finite number of at least 0.001 mm; invalid or unmet bounds return invalid. Omitting it (or null) preserves the default mesh. Requested meshes add max_deviation_mm and achieved_deviation_mm; see mesh tolerance. specify_pmi.serve.reply(request) answers the same requests in-process.

What it writes

AP242 semantic PMI: datums and datum systems, size dimensions with ± and fit tolerances, location dimensions, position, flatness, perpendicularity, parallelism, profile and runout tolerances, threads, knurls, surface texture, material, notes and the general tolerance. Every file is read back and checked before it is kept.

Status: early (0.x). The JSON formats may change between minor versions; changes are listed in the changelog. Draftwright® is a registered trade mark of Betwixt Ltd.

There is no export of answers as a record (ADR P11, 0.3.0: api.export_answers is removed); the written STEP holds them. See answer files.

Metadata

Release files for specify-pmi 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for specify-pmi 0.3.0
File Size Uploaded Provenance Actions
specify_pmi-0.3.0.tar.gz 7.7 MB With provenance Details for specify_pmi-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for specify-pmi 0.3.0
File Actions
specify_pmi-0.3.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for specify_pmi-0.3.0-cp311-abi3-win_amd64.whl
specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl
specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl
specify_pmi-0.3.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for specify_pmi-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
specify_pmi-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for specify_pmi-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 101.0 MB

Release files / specify_pmi-0.3.0.tar.gz

Download URL specify_pmi-0.3.0.tar.gz
Size 7.7 MB
Tags Source
SHA-256 checksum
How to use checksums
9607bfbcbb1a9b3bcfe8cba92ceabcdda8a2e9a6ba9ce67280006b5cd7873fa6
BLAKE2b-256 checksum
How to use checksums
345c0b404de1371c1e1be69e7a38b95f93565dd594b775ce2a887570a73d33e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / specify_pmi-0.3.0-cp311-abi3-win_amd64.whl

Download URL specify_pmi-0.3.0-cp311-abi3-win_amd64.whl
Size 19.3 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
24b141b40fd993d56d701f4421efbb9f5a264f37eb25aeb4c78ce9438c9ed294
BLAKE2b-256 checksum
How to use checksums
66b655dff3dd2d05bfc96eb8508f733f262afd01c96d62bbb7583f2ee5cc6536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 19.3 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
b91403a9fe50ac4152cb2ba929ed66f62e27337a68c3c2cd744445d5ce0b3068
BLAKE2b-256 checksum
How to use checksums
3fabf5b281060b04a197b1af3f63c92817c5f044a352464d5beacdf112bbc8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL specify_pmi-0.3.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 18.1 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
2b4e3bee4419318b3c15d3917c8ed0b165c6a61caf6f0d0571882907c6945dea
BLAKE2b-256 checksum
How to use checksums
3cd3d997eaf44a368a73baab03545f9918f944397dd14a461bd55543b4b9fee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / specify_pmi-0.3.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL specify_pmi-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
Size 17.9 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3fa371319dd0753245870eccfd129a0c987f3b9a6f50a433e23834da49ade4b0
BLAKE2b-256 checksum
How to use checksums
2589c645d16b72d5cd7d3d4de63df53df9daa34b3ddbbd95c61de994597515f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / specify_pmi-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL specify_pmi-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 18.7 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
dd706f724393f4945e2b6b2892671110de7dc9e03bce0b05de8eef0b7bd3c193
BLAKE2b-256 checksum
How to use checksums
9b2113826de518263785a68264fba5174fb09139070c56e91b5529407c8bd9e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for specify-pmi 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for specify_pmi-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page