Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Workpiece

Workpiece is a CAD kernel and a desktop application written in Rust. A part is a list of steps that the program applies in order to build solids and surfaces on NURBS geometry; changing an early step rebuilds the ones after it. Parts can be edited in the app, scripted from Python through a command line, put together into assemblies with joints, and drawn on ISO sheets.

It is an early prototype. The part file format and the crate APIs are not stable.

The source, the issue tracker and the contribution guide are in the repository. Workpiece is licensed under MIT or Apache-2.0, at your option.

Install and run

There are no releases yet; Workpiece is built from source.

Build and run

You need a Rust toolchain of version 1.95 or newer (install with rustup) and a C compiler. Tested on Linux only (Ubuntu); macOS and Windows have not been tried by the authors.

On a fresh Debian or Ubuntu system:

sudo apt install build-essential git
# To run the app: the window system and OpenGL libraries, which the app loads when it starts
# (eframe/winit/glutin open them with dlopen, so they are not link-time dependencies):
sudo apt install libgl1 libegl1 libx11-6 libxcursor1 libxi6 libxrandr2 libxkbcommon0 libxkbcommon-x11-0 libwayland-client0

The package names of the second line are the Debian names of the libraries the binary tries to load (libEGL, libX11, libXi, libxkbcommon, libxkbcommon-x11, Wayland); they have not been tried on a fresh install.

git clone https://github.com/geop-cad/Workpiece.git
cd Workpiece

# The desktop app (optimized build: the geometry is slow without the optimizer)
cargo run --release -p workpiece-app
cargo run --release -p workpiece-app -- part.wpc   # open a part file

# The command line
cargo build --release -p workpiece-cli
target/release/workpiece kinds                          # the kinds of steps and their arguments
target/release/workpiece make recipe.json -o part.wpc --report report.json
target/release/workpiece report part.wpc         # build a part there is, and say what came of it

# A part from Python (builds the command line first; needs Python 3)
cargo build --release -p workpiece-cli
PYTHONPATH=python python3 agent/examples/flange.py   # or: pip install ./python, which also builds both programs

WORKPIECE_DEMO=1 cargo run --release -p workpiece-app opens a small assembly instead of an empty part (WORKPIECE_DEMO also takes sketch, blends and joints). The app keeps its settings and library of materials in a configuration folder, which WORKPIECE_CONFIG_DIR overrides.

Features

What works today

Grouped as the tabs of the app are (see Ribbon.md for the full list, including what is not done yet).

Modelling (Modeling and Surfacing tabs)

  • Extrude, revolve, sweep and loft (with twist and scale, coils), thicken, close surfaces into solids.
  • Fillet (constant or variable radius) and chamfer on edges of any NURBS shape, shell, draft, rib, emboss and engrave.
  • Holes to the sizes of the standards (clearance, counterbore, countersink, tapped) and threads, cosmetic or modelled.
  • Booleans (join, cut, intersect) on tolerant B-reps; a boolean that cannot be done exactly is refused with a reason.
  • Split, delete body, transform, linear, circular, path, sketch and feature patterns.
  • Direct edits: move, offset, delete and replace faces.
  • Datums: planes, axes and frames in several constructions; curves (projected, intersection, helix, 3D spline).
  • Surfaces: boundary (fills holes too), ruled, offset (and copy), extend (and untrim), split by a sketch, curves or a plane, surface fillet.
  • Polygon meshes and subdivision surfaces edited in the scene.
  • Inspection: measure, mass properties, section analysis, interference and clearance, zebra and curvature display, draft analysis.
  • Parameters and formulas, variants (a table of parameter values), materials with density, colour and a path-traced render step.

Sketcher

  • Lines, arcs, circles, rectangles, slots, polygons, ellipses, splines, points and text.
  • Constraints (coincident, horizontal, vertical, parallel, perpendicular, tangent, curvature, equal, midpoint, symmetric, fix, and more) and driving dimensions with tolerances, solved by the geometric solver in lib/solver; the sketch says how many degrees of freedom are left.
  • Trim, extend, split, offset, mirror, move, copy, rotate, scale, patterns, fillets and chamfers; projection of edges and faces of the model into the sketch.

Assemblies

  • Insert part files, STEP files and a catalogue of standard parts (ISO 4017 and 4762 screws, nuts, washers, ball bearings).
  • Joints (rigid, revolute, slider, cylindrical, planar, ball), limits and drives, gear, rack and screw mechanisms, dragging parts within what the joints allow.
  • Pattern and mirror parts, cut and weld features across parts, interference, bill of materials, exploded view.

Sheet metal

  • Flange, bend, unfold and flat pattern.

Drawings to ISO

  • A drawing is a step of the part: views (projected, section, detail, pictorial), dimensions with ISO 129-1 tolerances, datums (ISO 5459), centre lines, notes, balloons, parts lists, title block templates, third-angle or first-angle projection, cosmetic threads drawn as ISO 6410 has them.
  • Export as PDF and DXF.

Exchange

  • Import: STEP (AP203, AP214 and AP242 boundary representations), IGES (trimmed surfaces and the faces of its solids), STL and 3MF.
  • Export: STEP (AP214), IGES, STL, 3MF; a part’s outline as G-code (.nc).

Python layer and command line

  • workpiece (the command line) makes a part from a JSON recipe, builds it and reports what happened: which steps failed, the degrees of freedom of each sketch, the volumes after each step, the named faces and edges of the result.
  • python/workpiece/ is a small Python library over it for writing parts as scripts (pip install workpiece brings it with both programs). See agent/README.md and the four scripts in agent/examples/.

Ribbon

What each tab of the ribbon holds. ✓ marks what is implemented. Anything noted as “not implemented” is not there. A feature with several ways of working is one button with a mode in its dialog (a fillet’s radius / width / distance, a pattern along a line / around an axis / along a path), not one button a way.

Sketch

(shown while a sketch is edited)

Sketch

  • Plane ✓
  • Status (degrees of freedom) ✓
  • Grid ✓
  • Finish sketch ✓ (the Done button, or Enter)

Draw

  • Select ✓
  • Line (chains into tangent arcs) ✓
  • Rectangle (corner, centre) ✓
  • Circle (centre, 2-point, 3-point) ✓
  • Arc (3-point, centre) ✓
  • Slot ✓
  • Polygon ✓
  • Ellipse ✓ (an exact closed curve by its hull; no ellipse constraints)
  • Spline (control points, through points) ✓
  • Point ✓
  • Text ✓ (the letters’ outlines as lines and curves, written from a point at a height; one font; held where written, not text that can be edited afterwards)

Constrain

  • Coincident / Concentric ✓
  • Horizontal, Vertical ✓
  • Parallel, Perpendicular ✓
  • Collinear ✓
  • Tangent ✓
  • Curvature (G2) ✓ (a plain spline running on from the line, arc or spline it ends on)
  • Equal ✓
  • Midpoint ✓
  • Symmetric ✓
  • Fix ✓

Dimension

  • Dimension (length, distance, angle, radius, diameter; tolerances) ✓

Modify

  • Trim ✓
  • Extend ✓ (a line on to a line or circle)
  • Split ✓ (a line or an arc at a point)
  • Sketch fillet, Sketch chamfer ✓
  • Offset ✓
  • Mirror ✓
  • Move (drag) / Copy / Rotate / Scale ✓
  • Linear pattern, Circular pattern ✓ (free copies: not tied to their original)
  • Construction ✓
  • Delete ✓

Reference

  • Project (edges, faces, vertices) ✓
  • Intersect ✓ (the solid bodies cut by the sketch plane, drawn once as curves of the sketch’s own)
  • Convert a projection into free geometry ✓

Solid

Construct

  • Sketch ✓
  • Plane ✓ (offset, midplane, at an angle, through 3 points, through an axis and a point, normal to an axis, parallel through a point, tangent to a face at a point)
  • Axis ✓
  • Point ✓ (a frame at a picked point: Frame’s “At point”)
  • Datum (frame) ✓
  • Curve (project onto a face) ✓ (a curve body thrown onto a face along an axis)
  • Curve (intersection of two faces) ✓ (where two picked faces cross, as far as both reach)
  • Curve (helix / spiral) ✓ (a helix about an axis, or a spiral whose radius grows each turn — flat, without a pitch)
  • Curve (3D spline through points) ✓ (a smooth cubic spline through picked vertices, frames and places on faces; each end free, tangent (G1) or curvature (G2) continuous to an edge or axis, lying in or normal to a face or plane — a held end flipped by a button, its tangent length (fullness, 1 natural) set by a number or by dragging the arrow at the end (through the end: flipped), lying in a face turned within it by a knob in its tangent plane; Sweep can follow any curve body)

Create

  • Extrude ✓
  • Revolve ✓
  • SweptLoft ✓ (sections as a list — sketches, faces’ outlines; curves as a list, each a path or a guide: sweep one section along a path, mitered at its corners, with twist and scale; coil around an axis: springs; loft through sections, following guide rails, leaving its first and arriving at its last section free, normal to it, or tangent (G1) / curvature (G2) continuous to a face)
  • Thicken Surface ✓ (faces or a whole surface, to one side or both; rounded or sharp corners)
  • Solidify Surface Patch ✓ (no step of its own: a Boundary that closes the last hole of a surface makes it a solid; Offset by 0 of surfaces that close all around copies them into a solid)
  • Primitives: none on the ribbon (box, cylinder, sphere, cone and torus steps of older parts still build)
  • Import (STEP ✓; IGES ✓ — trimmed surfaces (144) and the faces of IGES’s own solids (186 / 514 / 510 / 508 / 504 / 502), on NURBS surfaces (128), planes (108, 190), cylinders, cones, balls and tori (192 to 198), surfaces of revolution (120), tabulated cylinders (122) and ruled surfaces between like curves (118), bounded by 126 / 110 / 100 / 102 curves, sewn into solids where they close; offset surfaces are told of and left out; STL ✓ and 3MF ✓ — a closed mesh as a solid with flat faces, up to 20 000 triangles)

Modify

  • Fillet (constant, variable; rounded / mitered corners) ✓

  • Chamfer ✓

  • Shell ✓ (inward; open at picked faces, or closed)

  • Draft ✓ (about a neutral plane; one way or both)

  • Hole ✓ (simple, counterbore, countersink, tapped; for a screw size of the standards — M1 to M64: the clearance hole fine, medium or coarse (ISO 273), the counterbore for a socket head cap screw (ISO 4762, DIN 974-1) or a hexagon head (DIN 974-2), the countersink for a socket (ISO 10642, DIN 74) or slotted/cross recessed (ISO 2009, ISO 15065) countersunk screw, the tap drill for the coarse or a fine thread (ISO 261/262) — or to sizes of its own, a plain bore with its ISO 286 class (H7, F8, …); a tapped hole’s thread cosmetic by default, or modelled; a deburring chamfer where it goes in, where it comes out, or both; at the points of a sketch, on a face a distance from each of two planes, or on a face a distance from an axis at an angle around it; to a depth or through)

  • Thread ✓ (on a rod or in a hole, right- or left-handed; cosmetic by default — the face stays a cylinder, the thread shows as a helix on the model and is drawn as ISO 6410 has it: narrow lines along the roots and a wide one across its end from the side, three quarters of a narrow circle along its axis, dashed where hidden, the hatching of a section running to the crests — or modelled as a V groove; the ISO metric coarse thread for the face’s diameter, or a pitch and depth of its own. Not implemented: cosmetic threads of placed parts in an assembly’s drawing, a thread callout (M6) as a dimension, a thread shorter than its face)

  • Rib ✓ (in the plane of its sketch, to the body)

  • Emboss / Engrave ✓ (the areas of a sketch onto faces, flat or curved; text once sketches have it)

  • Split ✓ (a body by a plane, a flat face, or faces of any shape that go all the way through it — a surface or some of its faces; not implemented: a face by a curve)

  • Delete Body ✓ (solids, surfaces, meshes)

  • Boolean (join, cut, intersect) ✓

  • Transform (Move, Copy, Rotate, Scale, Mirror) ✓

  • Linear Pattern ✓ (of bodies: as bodies, joined, or cut out of another)

  • Circular Pattern ✓

  • Path Pattern ✓ (along the curves of a sketch; turned with it or upright)

  • Sketch Pattern ✓ (at the points of a sketch)

  • Feature Pattern ✓ (the count a whole number; what steps did to a body — holes, bosses, pockets, fillets, several at once — done again along a line, around an axis, along a path or at points; the features are told by a face of each)

Direct Edit

  • Move / Offset Face ✓ (press-pull: off themselves or along an axis; neighbours that lie along the move run on, others are left with a step)
  • Delete Face ✓ (Delete on the Surfacing tab: a hole, pocket or boss whose rims each lie in one face; not implemented: rounds, or what runs into a face’s edge)
  • Replace Face ✓ (by a plane: a way of Move Face; not implemented: by another surface)

Inspect

  • Measure ✓ (select one thing or two: its length, area or place, their distance and angle, read in Contents)
  • Mass Properties ✓ (a step on the Properties tab: mass, volume, centre of gravity, the inertia tensor and principal moments of bodies taken together, each body by its own material; shown in the view as the ellipsoid that weighs and turns alike)
  • Section Analysis ✓ (the bar over the view: the model drawn cut open as a Section step of the part cuts it, chosen from a list; the step’s offset is dragged by an arrow while it is edited, the model shown cut)
  • Interference ✓ (select two bodies: what they have in common, or their clearance)
  • Curvature / Zebra ✓ (Contents → Display → Analysis: zebra stripes mirrored in the faces, or colours by how tightly they bend; and a selected face’s tightest bend radius as a reading)
  • Draft Analysis ✓ (Contents → Display → Analysis → Draft: faces coloured by their draft from a pull along z; and a selected face’s draft, least and most, as a reading; not implemented: other pull directions)

Surface

Construct

(same as Solid; Curve through points is a large button of its own here as well)

Create

  • Extrude ✓ (a sketch, or any edges and curves of the model — in space too, several at once, connected ones giving connected faces — along a picked direction: an axis, a straight edge, a plane’s or flat face’s normal; without one, the normal of the plane the curves lie in. As a solid only curves closed in a plane)

  • Revolve ✓ (a sketch, or edges and curves as for Extrude, about the picked axis)

  • SweptLoft ✓ (as the solid’s, without its flat ends; also through edges and curves left open — a loft between two curves is a ruled surface; a held end can be flipped, made fuller (tangent length) and, running on from a face, turned within it: numbers, and a knob in the face’s tangent plane)

  • BoundarySurface ✓ (over a hole of any number of sides — edges or curves end to end, one closed edge too — each side free, tangent (G1) or curvature (G2) to the face beside it, a held side flipped, made fuller and turned within the face’s tangent plane by numbers or a knob at its middle; all free and in one plane: a flat face; four free sides: the Coons patch through them exactly; others fitted, within a stated tolerance of the sides. Sewn to the surfaces whose free edges it runs along; closed all around by that, a solid — this is also Fill hole)

  • SubD ✓ (a subdivision surface from a patch: a surface body, not a solid, even when it closes)

  • FromSolid (copy faces) ✓ (Offset by a distance of 0)

  • OffsetSurface ✓ (each face its offset, sewn where they still meet; they do not run on to each other; to the side the faces’ normals point, or flipped; by 0, a copy of the faces — closed all around, a solid)

Modify

  • Split ✓ (as Emboss takes its outlines: Sketch — the areas of a sketch thrown onto the faces along its normal, only the first face they meet — or Curves on face — closed curves already on them (a projection, edges); the faces of a surface or a solid are split in place. Or Plane: a surface in two. Not implemented: by another surface)

  • Trim ✓ (no step of its own: Split, then Delete what is not wanted)

  • Extend ✓ (past its free edges, by a distance; or To the whole surface — Untrim: every face back to all of its surface)

  • Fillet, Chamfer ✓ (the solid’s steps: edges of a surface between two of its faces too; not implemented: between surfaces that do not meet in an edge)

  • Delete ✓ (faces of a surface or whole surfaces; faces of a solid — a hole, a pocket, a boss — taken off and closed over: Delete Face is this button)

  • Transform (Move, Copy, Rotate, Scale, Mirror) ✓ (the solid tab’s Transform takes surfaces too)

Inspect

  • Measure ✓ (as for solids: a surface’s area, a face’s area, an edge’s length, distances and angles)
  • Curvature / Zebra ✓ (Contents → Display → Analysis: zebra stripes mirrored in the faces, or colours by how tightly they bend; and a selected face’s tightest bend radius as a reading)
  • Open Edges ✓ (select a surface: how many of its edges are open, and how long they are together; not implemented: shown on the model)

Assembly

Part

  • Insert part (a part file or a STEP file) ✓
  • New part (made in place) ✓
  • Standard part ✓ (one catalogue searched by typing — hexagon head screws ISO 4017 and socket head cap screws ISO 4762 in their lengths, nuts and washers M3–M16, dowel pins ISO 8734, eight ball bearings — with filters for the kind of part and the size; each kind has a seat — a screw’s ring under its head, a nut’s or a washer’s face, a pin’s end, a bearing’s side face — that its first mate starts at, so one pick of a face or a hole’s rim stands it there, revolute (concentric, coincident); more mates as for any placed part; threads, sockets and bearing balls drawn plain; in millimetres)
  • Replace part ✓ (edit the step that places it and choose another file)
  • Pattern part ✓ (each a step — a move, a turn — from the one before; fastened to the first)
  • Mirror part ✓ (the part’s bodies mirrored in a plane; fastened to the part; not implemented: sub-assemblies)

Position

  • Connector (a frame on a part to join by) ✓
  • Joint (rigid, revolute, slider, cylindrical, planar, ball) ✓ — a placed part (Add part, Standard part) is held by a list of mates, rows added and removed: each a reference on what is there (Onto) and one on the part (With), each with a button that turns it over, and the constraint between them from a drop-down with icons of the joints that fit the two (two axes or rims turn in each other by default, anything else is fastened); two mates hold what one leaves free. Fixed or not is a choice of its own. No gizmo: a part not yet held is dragged where it goes
  • Ground (fix a part where it is) ✓ (a part’s “Fixed” way of moving)
  • Move (drag within what the joints allow) ✓ (the left button drags a placed part, while nothing is edited and while a step is — a part being placed too; a fixed part stays)
  • Mechanism (gear, rack and pinion, screw: one joint driving another) ✓ (its joints are pointed at in the view: while a joint field picks, the joints it takes are drawn where they are, highlighted under the pointer and named beside it)
  • Joint limits ✓ and drives ✓ (Drive holds a joint at an angle or a distance; with a parameter there, the variants run it through its range; and Contents → Display → Motion runs a joint that has limits from one to the other by a slider, the parts drawn where that leaves them)

Assembly Features

(what is done to the parts once they are put together)

  • Cut / Hole through several parts ✓ (Cut parts: bodies of the assembly cut out of every placed part they run into; the parts’ own files stay as they are)
  • Weld bead between parts ✓ (Weld: a round bead along picked edges of placed parts, less what the parts take up — a quarter round in a corner; a body of the assembly)

Inspect

  • Measure ✓ (select things of placed parts as of the part itself: one is measured in its part’s own coordinates, two across the parts as they are placed)
  • Interference / Clearance (between parts) (which placed parts run into each other, and by how much, and the least clearance between parts whose boxes are apart (from points along their edges), in Contents ✓)
  • Section Analysis ✓ (as for parts: cut through every placed part)
  • Mass Properties (of the assembly) ✓ (volume and centre of gravity of all that is placed, in Contents; not implemented: mass, inertia)
  • Exploded View ✓ (Contents → Display: the placed parts drawn apart from their middle; view only, no steps or trails)
  • Bill of Materials ✓ (the parts placed, counted, in Contents)

Manage

(the same in every tab: beside the ribbon, or a tab of its own)

  • Parameters ✓
  • Variants ✓
  • Material ✓ (what a part is made of: chosen in Contents or in the Materials panel of the Properties tab, Ctrl+6; its bodies show as it and weigh by its density)
  • Materials ✓ (the library every part chooses from: materials.json beside the parts, written as it is changed in the Materials panel; each material has a density, a colour, a texture drawn over it, and how it takes light — roughness, metal, clear. Textures are patterns worked out where the face is, not pictures)
  • Appearance ✓ (a step: bodies or single faces get a material or a colour of their own, over what the part is made of; it stands in the timeline like any step)
  • Render ✓ (a step that is a picture of the model as it is there: traced with light, shadows, reflections and glass, shown as it adds up while the view is turned as ever; studio, outdoor or dark-room light, a floor that catches the shadow, a backdrop colour; saved as PNG. Not implemented: pictures as textures, lights of one’s own, depth of field)
  • Units ✓ (a part’s unit of length — mm, cm, m, in — chosen in Contents; STEP and 3MF exports say it; not implemented: converting numbers, mixed units in one field)
  • Show / Hide ✓, Isolate ✓ (double-click a body in Contents)
  • Export (STEP ✓, IGES ✓, STL ✓ and 3MF ✓ from File → Export…; a drawing as DXF ✓ or PDF ✓ — see Drawing below)

Further tabs and workbenches

Features that sit outside the tabs above, as implemented (✓) and not implemented:

  • Annotate (Ctrl+5) ✓: what is said of the model on it — Datum (a face named A, B, C: ISO 5459), Dimension (as picked: of a round face its diameter, of an edge its length, of two things their distance or angle; with its tolerance: ISO 129-1) and Tolerance (a geometric tolerance of a face, of its form or from datums: ISO 1101). Each is made as a sketch’s dimension is: pick what it is of, then click beside the model where it stands — the tool goes on to the next. A sketch’s dimensions are said of the model too, and so are the sizes steps hold it to (an extrude’s distance, a revolve’s angle, a hole’s diameter and depth, the distance of a thicken, an offset, a moved face, a shell’s wall, an emboss’s height). Every measure of a step takes a tolerance, typed after the number (10 ±0.1, 10 +0.2/-0.1, 10 +0.2/-0.1 limits for the two limits of size, 10 H7) or chosen from the ± beside its field. With the Annotate tab open all of them show on the model as a drawing has them (ISO 16792): dimensions with extension lines, dimension line, arrowheads and the value over the line, in the plane they lie in (a sketch’s, in the sketch); datum boxes with their triangle on the face and tolerance frames with the characteristic’s symbol, facing who looks. Each is dragged by its text.
  • Camera view ✓ (Annotate → Camera view: a step that is a named way of looking at the model — as the view is turned while it is edited, from a side, or square onto a plane, a frame’s plane or a flat face, turned by an angle; the bar over the view sends the camera to it, and drawings draw the model from it)
  • Section ✓ (Annotate → Section: a step that says where the model is cut open — along a plane with an offset, or along the lines of a sketch, one or several end to end (an offset section), square to the sketch’s plane. The view shows the model cut so, and the section views of drawings are of it: they follow the part)
  • Properties ✓ (Properties → Properties: what the part says of itself — part number, revision, author, date, status — and, under Define properties, which properties the parts of the workspace have and what each is: text, whole number, number, date, yes/no or one of a list, with a default and whether it is required; kept in properties.json beside the parts. Title blocks read them)
  • Sheet templates ✓ (Annotate → Templates: what new drawings start from — the sheet’s size and projection, the views it starts with (sides, camera views of the part, projected views), and the title block cell by cell: where it is, its label, and whether it says text of its own or a property of the part or the sheet (Name, Material, Mass, Scale, Format, Sheet, Projection, or any property of the workspace); kept in sheets.json beside the parts; ISO 7200 blocks on A3 and A4 to start with)
  • Drawing ✓ (Annotate → Drawing asks what the sheet starts with — nothing, or the views of a sheet template — and adds a step that is a drawing of the model as it is there — in the timeline like any step, edited like a sketch in a workbench of its own; the code is the ops/drawing plugin. A sheet A4 to A0 with frame, centring marks and grid (ISO 5457) and title block (ISO 7200); views of the model from any side, projected views in line with them in first or third angle, auxiliary views along any direction of a view, views as the part’s camera views look at it, sections of the part’s Section steps with hatching, their cutting line with arrows and letters in a view that looks along the cut, nothing drawn where an offset section steps aside (ISO 128-3) — a cutting line drawn corner by corner in a view makes the part a sketch of it on the plane that view looks onto and a Section step along it, and dragging its corners draws that sketch anew — details at a larger scale, whose middle and reach are dragged afterwards; beside the sheet the timeline stays as everywhere, and the dialog at the right says what is selected on the sheet: with nothing selected the sheet itself (size, how it lies, scale, projection, template), a view (what it shows — a side or one of the part’s camera views, changed at any time — its section, lines, scale, letter), or the title block (a click on a cell selects it and goes to that cell’s field): text of the sheet’s own, or the part’s properties; each view with hidden lines removed or dashed, as a wireframe, or shaded; centre lines of what is round. “Show missing” draws what is said of the model and is not on the sheet in blue as what it would be — in the selected view, or in every view that sees it true, stacked 10 and 7 mm off the outline — and a double click puts it on the sheet. No line runs through a dimension’s value: lines that would are interrupted. Dimensions of the sheet’s own as in a sketch: click two points, a line or a circle, then beside it. Draw puts the tools of the sketcher on the sheet (lines, circles, arcs, splines, lettering, constraints, dimensions), snapping to the views. Export as PDF, DXF (a layer per kind of line) or SVG, true to size. Not implemented: several sheets of one drawing numbered together, broken views and broken-out sections, sections turned into the plane (aligned sections), a parts list with balloons, surface texture and welding symbols, thread and hole callouts, ordinate and chained dimensions. File → Export… as .dxf or .pdf without a drawing open still writes the three views and a section by itself)
  • Sheet Metal (flange ✓ and bend ✓: Flange, on the Sheet metal tab (Ctrl+4), bends a flange up along a straight edge of a plate; unfold ✓ and flat pattern ✓: Unfold lays the bent sheet out flat from a picked face as a new body, each bend as long as its neutral layer by the K-factor; a tab of its own ✓ with sketch, datums, extrude, flange, unfold, hole and fillet; not implemented: reliefs at corners, hems and jogs)
  • Mesh / SubD ✓ (no tab of their own: SubD is on Modeling, Mesh on Surfacing): SubD and Mesh add a step that is a control mesh — points, and faces of any number of corners — edited in the scene in a workbench of its own; the code is the ops/mesh plugin. The body it makes is the mesh’s flat faces (Mesh), or the subdivision surface it controls (SubD: Catmull–Clark) as bicubic NURBS faces that share their edge curves — a solid if the mesh is closed, a sheet if not — on which every other tool works. Where four quads meet at each corner of a face the face is one NURBS face and the very surface; a face with another corner is four faces of the mesh one step finer, and only the quarter at that corner comes close to the surface (Finer: more steps). Creased edges and the rim of an open mesh stay sharp. Lines — free edges, of no face — make curves the same way: each run of them a wire body {step}/curves whose edges ({step}/curves/e0 …) later steps take as any curve (sweep path, loft rail …): smooth, the limit curve of its subdivision (a uniform cubic B-spline over its points, through its open ends, closed round a loop, sharp at a point made a corner by Crease); flat, the run itself.
    • Select: points, edges or faces, one choice of three pictures (1, 2, 3); click, Ctrl-click, a frame dragged open; double-click an edge for its loop, a face for all that hangs together; in the context menu (and by their keys): All (Ctrl+A), Invert (Ctrl+I), Linked (Ctrl+L), Loop (L), Ring (Shift+L), Grow (Ctrl+G), Shrink (Ctrl+Shift+G), and the select tool back (Esc).
    • Move: a gizmo in the middle of what is picked moves and turns it (along the world’s axes or the normal), scales it all at once by its outer ring (the factor shows while it is dragged), what is picked can be dragged itself, an arrow along each axis on the gizmo’s far side stretches it; the factors and moves can be typed (X, Y, Z, All); Falloff takes the mesh around along.
    • Snap (as Rhino’s object snaps, with a toggle each and one for all, kept in the settings; Alt held moves freely): points (of the mesh, of other bodies, of sketches, datums’ origins), middles of edges, centres (circles, arcs, flat faces, the mesh’s faces), quadrant points of circles, crossings of edges as seen, the perpendicular from where a drag started, onto an edge, and the grid — not drawn, its spacing following the zoom as the sketcher’s does; along a gizmo arrow the snap target is seen along the axis, and the grid gives whole steps of that axis. The target shows with the sketcher’s dot and badge.
    • Add: Box, Plane, Cylinder, Cone, Sphere (of quads), Torus — 10 mm across (a box’s edge, a plane’s side, the diameter of the others) — with size and pieces; Draw face, corner by corner; Line, point by point (one click: a point by itself).
    • Edit: Extrude (faces; edges; lines: a face along each; points: a new point joined by a line, on along the line it ends — a line drawn by extruding again and again), Inset (with depth; together or each face), Bevel (edges, one segment), Loop cut (cuts and slide), Knife (from point to point on edges and corners), Subdivide, Connect, Bridge (two runs of edges, two faces), Fill.
    • SubD: Crease (edges stay sharp; points of lines become corners of their curve), Finer.
    • Remove: Delete, Dissolve (points, edges, faces: no hole left), Merge, Collapse, Weld by distance.
    • Shape: Relax, Flatten, Duplicate, Split off, Inflate, Thicken, Flip, Outwards, Triangles, Quads, Poke.
    • Surface: Smooth (the subdivision surface, or the flat faces), Mirror X/Y/Z (the mesh is cut to its upper half and mirrored; points in the plane stay in it), Apply mirror.
    • What was done last keeps its numbers in the ribbon (distance, width, cuts …), to be typed anew.
    • Not implemented: a mesh made of a body or read from a file into the step (OBJ, STL as a mesh to edit), bevels of several segments and of points, edge and point slide, spin, sculpting, edge weights between smooth and sharp, hiding parts of the mesh, tangent snaps, a grid fill, UVs.
  • Mesh (import ✓ and convert to solid ✓: STL and 3MF read as solids with flat faces; repair ✓ as far as it is plain — doubled triangles dropped, all turned one way, holes closed from a corner; not implemented: editing a mesh, smoothing, self-intersections)
  • Simulation, CAM (CAM: File → Export… as .nc ✓ — the part’s outline halfway up it as G-code for a laser, plasma or water-jet cutter, holes first; nothing allowed for the width of the cut. Simulation: motion ✓ — a joint run through its range by a slider, see Assembly. Milling ✓, a first kind: File → Export… as .tap — the same outlines milled from the part’s top to its bottom in passes, with cutter compensation, for a tool 6 mm across in passes 2 mm deep. Not implemented: pockets and faces, turning, a choice of tools and feeds, stress or flow simulation)

Building Workpiece parts from a script

The workpiece Python package (python/workpiece/, installed by pip install workpiece) is a small layer over the workpiece command line (in a checkout: cargo build --release -p workpiece-cli). python -m workpiece starts the desktop app, workpiece (or python -m workpiece.cli) is the command line, and python -m workpiece.tools has the helpers (help, sheet, crop, tile). A script is the model: it says sketches with their constraints and driving dimensions, features, and patterns; Part.build(path) writes the .wpc file, solves and builds it, and returns a Report. agent/examples/ has complete scripts: flange.py, pinned_plate.py (assembly), bracket.py (a drawing built to a declared original), wood_box.py (parts + assembly sheet with detail, section, parts list). The browser app’s assistant runs the same layer in Pyodide, on the page’s WebAssembly kernel (_backend.py): there import workpiece works as it is, and there are no PDF tools, so sheets are looked at with its view tool rather than as files (docs/assistant.md).

Read the quick reference below; read a long section only when you need it with python -m workpiece.tools help <topic> (help alone lists the topics; help drawing, help centre-lines, help assemblies, …). Do not read this file whole on every pass.

Quick reference

import sys; sys.path.insert(0, "path/to/Workpiece/agent")   # the agent/ folder of this repository
from workpiece import (Part, original, view, projected, section_view, detail_view, note, balloon,
                   topo, datum, axis, placed, anchor, profile, material)
p = Part(unit="Inch" | "Millimetre", material="6061 Aluminium", title="NAME", file="x.wpc")
p.expect(original(views=[("front","Front"), ("iso","Pictorial")], numbers=[92, "R32", "Ø50", "(9)"],
                  notes=["(4) PLACES"], mass=(450.0, 0.3, "g"), units="mm"))   # once, from the original

Sketch (s = p.sketch("XY"|"YZ"|"ZX"|datum(id)|topo(face), id=, show_in=, on_drawing=); u,v = x,y on XY; y,z on YZ; z,x on ZX; coordinates are only a starting guess)

  • geometry: s.point(u,v,name), s.line(a,b,name), s.arc(centre,start,end,name,cw=), s.circle(centre,r,name), s.rect(prefix,u,v,w,h), s.slot(...), s.polygon(...), s.dot(u,v) (a hole’s place), s.construction(*curves), s.project(name, edge), s.rotation_axis(point, towards) (a centre line without end); s.origin, "u", "v"
  • constraints: coincident point_on horizontal vertical parallel perpendicular collinear tangent equal midpoint symmetric fix — a human’s geometric constraints, not computed coordinates
  • driving dimensions (each takes show_in= on_drawing= reference= tol= at=(x,y) decimals= id=): distance_u(a,b,val), distance_v, distance(a,b,val,far=), point_line, radius(c,val), diameter, angle(a,b,deg), diameter_about(point,axis,val); reference=True is a driven (60)
  • target 0 degrees of freedom: report.sketch(id)["degrees_of_freedom"]

Features: p.extrude(s, d, combine="NewBody|Join|Cut|Intersect", symmetric=, through=, flip=, id=) (instead of a sketch, curves: p.extrude([topo(edge), topo(curve)], d, direction=axis("Z")|topo(edge)|datum(plane)|topo(flat_face), surface=True) — any edges or curve bodies, in space too; no direction: the normal of the plane they lie in; a solid only of curves closed in a plane; p.revolve([topo(edge)], about=axis("Z"), angle=, surface=True) likewise), p.cut(s, d | through=True), p.revolve(s, about=None|"u"|"v"|axis_name|axis("Z")|topo(edge), angle=) (no about: the sketch’s one rotation axis, else u; “u”/“v” draw a rotation axis along the plane’s axis into the sketch; a sketch’s rotation axis ax is the datum axis datum(f"{s.id}/{ax}")), p.hole(s_with_dots, dia, depth=, kind="Counterbore"..) (or placed on a face: p.hole(None, dia, on=topo(face), at=(x, y) | off=[(ref, d), (ref, d)] | around=axis("Z"), radius=, angle=)), p.fillet(edges, r, tangent=True), p.chamfer(edges, d, tangent=True) (with tangent, the default, each edge comes with the edges that run on smoothly from it — a rounded outline’s lines and arcs, both halves of a rim — worked out at build time; tangent=False blends only the edges named), p.shell(open_faces, t), p.feature_pattern([face], count, about=axis("Z") | along=axis("X"), spacing= | points=sketch | fill=topo(face), grid=), p.feature_mirror([face], "Y"), p.pattern(body, ...), p.mirror(body, "Y", join=), p.plane("Z", 20), p.dimension(ref_a, ref_b, show_in=, reference=, tol=, kind=), p.datum_feature("A", on=topo(face)), p.geometric_tolerance("Position", 0.1, on=topo(face), datums=["A"], diametral=True) (see “Tolerances”), p.on_sheet(step_or_dim, show_in=, at=, on_drawing=), any other step p.op("Kind", id, **args) (workpiece kinds). p.sweep(section, path, twist=, scale=) (section a sketch or topo(face); path a sketch or a curve body topo(name)), p.loft([s1, s2, ...], guides=[curve, ...], start="Free|Normal|Tangent|Curvature", end=, start_face=topo(f), end_face=, surface=, start_flip=, start_magnitude=1, start_angle=0, end_…) (raw: sections=[{"of": ref, "end": "Free", "face": ref, "flip": False, "magnitude": 1.0, "angle": 0.0}], rails=[{"of": ref, "role": "Path"|"Guide"}], coil=axis(..) for a spring). Surfacing (p.op("Surface", way=..., picked=[...]), ways Offset(distance=, flip=; distance=0 copies the faces — closed all around, a solid) Extend(distance=, or whole=True: back to the faces’ whole surfaces, an untrim) Split Delete; Split split="Sketch" (sketch=profile(s), areas=) | "Curves" (curves=[topo(curve_or_edge)]) cuts the picked faces in place, as Emboss takes its outlines, or split="Plane", plane= cuts whole surfaces in two (a trim is a split and a Delete); Delete takes a surface’s faces, whole surfaces, or a solid’s faces (closed over)); p.op("Boundary", sides=[{"edge": topo(e), "way": "Free|Tangent|Curvature", "face": topo(f), "flip": False, "magnitude": 1.0, "angle": 0.0}]) fills a hole of any number of sides (a held side: flip leaves back over the face, magnitude the tangent length as a share of the natural 1, angle degrees turned within the face’s tangent plane from square across the side; one closed edge too; flat where all free and in a plane), sewn to the surfaces whose free edges it runs along — a solid where that closes them; Fillet/Chamfer take a surface’s inner edges too; p.op("Mesh", ..., surface=True) keeps a SubD a surface. A Mesh’s mesh may hold lines (free edges, [[a, b], ...]) and corners (points where their curve is sharp): each run of lines is a curve, the wire body {id}/curves with edges {id}/curves/e0 … to sweep along or loft through. Curves in space (wire bodies to sweep along), one kind each: p.op("CurveThrough", points=[topo(v), ...], closed=, start={"way": "Free|Tangent|Curvature|InFace|Normal", "to": topo(edge)|axis(..)|topo(face)|datum(plane), "flip": False, "magnitude": 1.0, "angle": 0.0}, end=) (flip runs the other way along what it is held to, magnitude the tangent length as a share of the natural 1 — fuller ends keep the direction longer; angle, InFace only, degrees within the face from the way the points lean), p.op("Helix", axis=axis("Z"), radius=, pitch=, turns=, grow=, start=deg, left=), p.op("CurveIntersection", first=topo(f), second=topo(g)), p.op("CurveProjection", onto=[topo(face)], curves=[profile(s) | topo(edge_or_curve)], along=axis(..) | None for a sketch's normal). Emboss/engrave onto faces: p.op("Emboss", faces=[topo(f)], sketch=profile(s), areas=[(u, v)], height=, engrave=, normal_to_face=) (the sketch’s areas thrown along its normal; only the first face they meet takes them — the near side of a ring; sides along the sketch’s normal, or square to the face), or outline="Curves", curves=[topo(curve_body) | topo(edge)]: closed curves already on the face (a projection; rings inside others are holes), raised square to it. Pick faces/edges after a build: rep.faces(where=lambda f: f["flat"] and f["normal"][2] > .99), rep.edges(near=(x,y,z), count=1) — both return names (strings: pass them as topo(name)), the where= filter sees each as a dict (name, area, middle, normal, flat, surface). Every wrapper takes id=.

Assembly: parts Part(file="a.wpc"); asm = Part(); asm.add_part(a, id="a", at=(x,y,z), euler=(..) | mates=[mate(anchor(topo(face),"FaceCentre",instance="a"), anchor(...), "Fastened", flip_with=True)]); asm.standard_part("SocketScrew", "M5", 12, mates=[mate(onto, seat(), "Revolute")]); placed("a", topo(face)); rep.faces(placed="a", ...); rep.masses, rep.mass_total (kg).

Drawing: p.drawing(views=[view("front","Front",(110,165), style="HiddenDashed"), projected("top","front","Above",75), section_view("secA","A",(x,y),of="top"), detail_view("det","top",(cx,cy),r,(x,y),scale=(5,1)), view("iso","Isometric",(x,y),scale=(1,2))], scale=(1,2), format="A3", centre_lines=[...], notes=[note(None,(0,0),"(4) PLACES",dimension="corners")], parts_list=True, balloons="auto", leading_zero=False, comma=False, decimals=, trim_zeros=True). Sides: Front Back Left Right Top Bottom; Isometric IsometricFrontLeft IsometricBackRight IsometricBackLeft Dimetric IsometricBelow{Front,Back}{Right,Left}. Front looks from +x (y right, z up): draw the front elevation on YZ, the side on ZX, the plan on XY.

Build and look (cheap, in this order; never render or crop by hand):

  1. rep = p.build("x.wpc"); rep.show() — steps, degrees of freedom, volumes, lint, scorecard, seconds. Identical rebuilds are reused; render=False (default) skips the sheet files.
  2. rep.sheet() prints the sheet as text (every view, dimension text as printed, what it measures, whether its ends are on drawn geometry, notes, centre lines, cuts, balloons, parts list, problems); also x.wpc.views/sheet.txt on every build; the scorecard is in show() and views/score.txt.
  3. p.build(path, render=True) — sheets as PDF/PNG plus one image per view views/view-<id>.png (about 1200 px, the view with its dimensions): open only the view that changed.
  4. python -m workpiece.tools crop sheet.pdf x y w h -o out.png (mm of the sheet from its lower left) or on a PNG (pixels) for any other crop; python -m workpiece.tools tile original.png --grid 3x2 -o dir cuts an original into overlapping 2x tiles to read its small text once.
  5. Mass: rep.mass_total (kg) with a material of the folder’s library, else rep.mass(density).

Conventions that bite: model the drawing’s own numbers (no derived values: 76 is not typed when the drawing says 92, 4, 9); one feature + a pattern/mirror, never copies; sketch dimensions as the drawing dimensions that view; blind hole floors are 118 deg (point=180 flat); a hole without depth goes through everything; names of faces/edges come from the report, never guessed; a dimension is shown only in a view that sees it true (show_in=), hidden edges need style="HiddenDashed"; report tool faults, do not work around them silently.

How to work

Builds are quick (a second or two): build after every step or two. workpiece report part.wpc --times prints the seconds each step, the drawing and the pictures took.

  1. Write the script step by step and call report = p.build("x.wpc") often; report.show() prints every step (ok / FAILED with the error), each sketch’s degrees of freedom, the bodies’ volumes, and lint. report.volumes_after(step_id) says what a step added or took.
  2. To pick faces and edges for fillets, shells, patterns, planes: build first, then report.edges(...) / report.faces(...) return names — filter with where= on an edge’s from, to, middle, length, straight, or a face’s middle, normal, area, flat, surface (“plane”, “cylinder”, “cone”, “other”: a revolved or bent plane is flat too); near=(x, y, z) sorts by distance and keeps count (1 if not said). A round rim is often two arcs: select by where, not by near, to get all of it (a fillet or chamfer with tangent=True, the default, takes the other arc along by itself).
  3. p.build(path, render=True) also writes path.views/{iso,front,top,right}.png for a part without a drawing (pictures=True forces them; a part with a drawing gets its sheets instead: see “Checking against the original”): look at them and compare with the drawing.
  4. Mass = report.mass(density) (volume × density; mm³ × g/mm³ is kg/m³ × 1e-6, in³ × lb/in³ is kg/m³ × 3.6127e-5), per body with bodies=[names]. Part(unit="Inch") for inch parts (“Millimetre” is the default).

The drawing

Views

p.drawing(views=[...], scale=(1, 2), format="A3") adds a sheet (third-angle by default; scale is a pair of whole numbers). Views:

  • view(id, side, at) — side “Front”, “Back”, “Left”, “Right”, “Top”, “Bottom”; pictorial “Isometric” (from front, right, above), “IsometricFrontLeft”, “IsometricBackRight”, “IsometricBackLeft”, “Dimetric” (ISO 5456-3), from below “IsometricBelowFrontRight”, “IsometricBelowFrontLeft”, “IsometricBelowBackRight”, “IsometricBelowBackLeft”; or the id of a camera view step, or view(id, direction=(x, y, z), up=(0, 0, 1), at=...) (looking from that way; the camera view is made for it), for any other direction (p.op("CameraView", "trimetric", looking="Current", ...), then view("pict", "trimetric", at)). at is the view’s middle in mm from the sheet’s lower left corner (A3 is 420 × 297).
  • projected(id, of, beside, distance) — “Left”, “Right”, “Above”, “Below” of another view, in line with it.
  • section_view(id, section, at, of) — the model cut by a Section step; with of it stays in line with that view, like a projected one. turn=90 turns it on the sheet (counter-clockwise, degrees) to stand as the original has it; a turned section stands where at says.
  • detail_view(id, of, centre, radius, at, scale) — a circled part of a view, drawn larger: centre and radius in the model’s lengths, from the middle of what of shows (across and up as that view shows them). A detail of an assembly’s view shows the placed parts (a divider in its groove); lengths sent there (show_in) are drawn in the detail at its scale, between the edges it shows, with their true values. Its letter stands by the circle by itself (outside it, clear of lines and words, on a short leader where it must stand off); letter_at=(x, y) puts it there instead (mm on the sheet from the circle’s middle). A length with only one end in the detail is drawn as a half dimension (ISO 129-1): one extension line, one arrowhead, its line running a little past the circle, the whole value; so is a length across the axis of a half section whose other end is not seen (a bore’s Ø).
  • caption_at=(x, y) on view, projected, section_view, detail_view puts the view’s caption (“B–B”, “A (5:1)”, a scale of its own) there: its middle, mm on the sheet from the view’s middle — it moves with the view. Else it stands over the view (a scale, under it).
  • style="HiddenDashed" on a view (also projected, detail_view, section_view) shows hidden edges dashed — of an assembly’s placed parts too. Use it where dimensions end on edges that are hidden (a floor, a wall’s inside, a divider inside a box): a dimension whose end is on an edge the view hides and does not draw, or on nothing the view draws, is named in the drawing’s problems.

Centre lines and lettering

  • Centre lines (ISO 128-2, long-dashed dotted narrow, a few mm past the outline, crossing at long dashes; continuous narrow on circles under 12 mm across): p.drawing(..., centre_lines="all") (default: of everything round — bores, bosses, turned bodies), "holes" (of holes only, told by their faces’ geometry, whatever step made them), "none", or a list, each in every view that can show it: a datum’s id (p.plane(...)‘s; “origin” a small cross, “origin/z” an axis; a plane shows only where it is seen edge on, as its trace), a hole’s or round feature’s step id or face name (its centre line; seen end on, a centre mark), ("pitch", "holes") the pitch circle of three or more like holes about one middle; the list may also hold “holes” or “all”: centre_lines=["holes", "mid", ("pitch", "bolts")]. One line said how it is drawn: a dict {"of": "bore", "view": "top", "hide": True} (a hole’s centre line taken off), "ends": (2, -1) (mm on past the outline, or less), "gaps": [(10, 18)] (broken from 10 to 18 mm along it: over a gap between lugs), "symmetry": True (ISO 128-2 symmetry marks at its ends), "label": "CL SYM" (words on it, by itself at the end where they stand clear; "label_at": "start" | "end" | mm); "of": "ZX" (the origin’s planes “XY”, “YZ”, “ZX”) draws that plane’s trace: a plane of symmetry. In the app a selected line shows how far its ends run on. A dimension that ends on a datum plane or axis (a plane’s offset) draws that datum’s trace. line_width=0.7 sets the wide lines (narrow half of it; default 0.5 on A4–A2, 0.7 on A1/A0); dashes follow ISO 128-2 (dash 12d, gap 3d, long dash 24d, dot 0.5d). lettering=5 sets the height of dimensions’ and notes’ lettering (ISO 3098: 2.5, 3.5 (default), 5, 7); views’ names, section and detail letters and balloon numbers are a size up. With centre_lines="holes" the holes of placed parts (an assembly) get theirs too. A radius or diameter whose text stands outside the round is on a leader with the text level on a short shoulder (ISO 129-1); aligned_leaders=True turns it along the leader instead. trim_zeros=True writes no more decimals than a number needs, up to decimals (inch: .5, 1.125, 2.75; a dimension’s own decimals= stays exact). thru=True makes a through hole’s callout say Ø6 THRU (default for inch parts); words attached to a callout (note(None, (0, 0), "4 PLACES", dimension="bore/callout")) stand under its last line.

Tangent edges, half sections, parts list

  • p.drawing(..., tangent_edges="Thin") — smooth edges, where a fillet runs into the face it rounds, are drawn thin (default), "Hidden" not at all, "Wide" as other edges. Where one surface goes on across an edge (two halves of a tube) nothing is drawn.
  • Half sections (ISO 128-3): section_view(..., half="Left") (“Right”, “Above”, “Below”: the half of the view that is cut) — the other half is drawn uncut, the two divided by a centre line at the part’s axis: the axis of what is round that the cut passes through (nearest the view’s middle), else the Section’s own origin; half_only=True leaves the other half out (a symmetric part’s section from its axis outward). A section takes its own scale with scale=(1, 2), written beside its name (A–A (1:2)). Each body or placed part it cuts is hatched its own way; hatching runs at 45° unless the cut’s outline runs that way (then 135°, 30°, …), closer in a thin wall.
  • Parts list and balloons (an assembly, ISO 7573 / ISO 6433): p.drawing(..., parts_list=True, balloons="auto") — a table over the title block (item, quantity, name: the placed part’s Part(title="WOOD BOX"), else its file’s name; material; parts_list=["item", "qty", "name", "material", "density"] says the columns), a part placed several times one item; each item a balloon (its number in a circle, a leader ending in a dot on the part) in the first view that shows it, outside the view, clear of the rest. balloons=[balloon("rod1", "front", (60, 40)), "auto"] puts one by hand (mm from the view’s middle; to=(x, y) its leader’s end) and the rest by itself. In the app: Format → Parts; drag a balloon to put it by hand.

Which side is which

Which side is which. Workpiece’s Front looks at the model from +x: the Front view shows y to the right and z up — exactly a sketch on “YZ” (u right, v up). So draw the part’s front elevation on YZ, its side elevation on ZX (the Right view shows it with x running to the left, z up), and its plan on XY (the Top view shows y to the right and x downward: a quarter turn from how the sketch is drawn). If the original’s front view shows the part’s long side, lay that side along y. Base the sheet on view("front", "Front", …) and project the others.

Which dimensions appear

Which dimensions appear. Every driving dimension of every sketch, every extrude or revolve’s own distance or angle, and every p.dimension(...) step. To make the sheet read like the original:

  • dimension each sketch the way the drawing dimensions that view (same numbers, same references) — a derived number in a sketch shows up as a number the original does not have;
  • p.sketch(plane, show_in="top") puts that sketch’s dimensions in the view with that id;
  • p.sketch(plane, on_drawing=False) keeps a helper or cutter sketch’s dimensions off the sheet;
  • p.dimension(face_a, face_b, show_in="front") adds a number no sketch carries (a depth, an offset) between two named faces or edges.

More for matching the original:

  • Steps say their own sizes. A Fillet puts its radius on the sheet (R8, once), a Chamfer its distance(s), a Draft its angle, a Hole one callout (ISO 129-1) on one leader to a rim the view draws (the bore’s, else a counterbore’s) — Ø6 ↧10 (depth only if blind; a tapped hole its thread and the thread’s depth over its tap drill’s bore, M6 ↧9 / Ø5 ↧12, or M6 THRU), 4× before it for several holes (its places times what feature patterns and mirror images of the hole made after it repeat it), a counterbore ⌴Ø11 ↧6 or countersink ⌵Ø12 × 90° under it; it is called <hole id>/callout and placed by one at (p.on_sheet("bore", at=(30, 20))). p.on_sheet("bore/callout", count=6) says the count outright (count=False: none); p.drawing(..., places=True) writes it as a line (6) PLACES after the callout instead of 6× before it. A depth that follows from a face (up_to=, head_up_to=) is written, as a reference ↧(50), only with p.drawing(..., reference_depths=True) — an Extrude or Revolve its distance or angle (not when it ends “to next” or “to a face”), a Shell its wall thickness (once), a Rib its thickness, a Pattern its spacing (along a line) or angle (over less than a full turn), an offset plane (p.plane) its distance, a plane at an angle its angle, a frame its moves and turn. A fillet measured by width or distance says that. Steer or hide them per step: p.on_sheet("round", show_in="top"), p.on_sheet("pocket", on_drawing=False); a placed part’s own on an assembly’s sheet: asm.on_sheet(placed("box", "base_sk/width"), show_in="front"); one of a step’s several by its own name: p.on_sheet("bore/callout", at=(30, 20)), p.on_sheet("plate/distance", show_in="top") (a name the model does not say is an error).
  • Each dimension can go its own way: s.distance(a, b, 50, show_in="side"), s.radius(arc, 6, on_drawing=False) — over what the sketch says for all of its.
  • Naming a sketch dimension: s.distance(a, b, 50, id="width") calls it <sketch>/width (else <sketch>/d<n>, n a counter), to attach words to it (note(..., dimension="base/width")) or place it (p.on_sheet("base/width", at=(0, -30))).
  • A diameter on a turned profile: s.diameter_about(point, line, 50) — twice the point’s distance from the axis line, shown Ø50 (use it where the original shows a diameter of a revolve’s profile; "u" / "v", a rotation_axis or any line is the axis). Draw the sketch’s rotation axis with ax = s.rotation_axis(point, towards): a construction line without end through point, towards another point (which it passes through too) or along a direction (du, dv) — three degrees of freedom, constrained like a line (vertical(ax), point_on, parallel, angle). p.revolve(s) with no about turns the sketch about it. In the app a dimension from a point or line to it, its text placed across it, is a diameter; it stays one until its “Diameter” mark is cleared.
  • Driven (reference) dimensions (60): s.distance(a, b, 60, reference=True) (any sketch dimension) holds nothing — the sketch must be fully constrained without it — and shows what the rest makes it, in brackets; p.dimension(f1, f2, reference=True) likewise. Driven dimensions never count as constraints (degrees of freedom, redundant/conflicting). (In the app a dimension that would over-define the sketch is added driven, and the “Driven” mark in its panel switches it; to driving only where that does not over-define.)
  • To the side of a circle: s.distance(point_or_line, arc, 8) measures to the near side of a circle or arc, far=True to its far side (a slot’s whole length from a line to the far side of its end); s.distance(circle_a, circle_b, 4) is the gap between two circles, or the wall between one and another inside it.
  • Words on the sheet: p.drawing(..., notes=[note("top", (30, 20), "(2) PLACES")]) — their middle in mm from the view’s middle. note("top", (60, 50), "CENTER OF R75", to=(-120, 0, 0)) gives them a leader (ISO 128-22) to a point of the model (or an edge/face dict from the build report: its middle; or (x, y) in the view, model lengths from what it shows’ middle): an arrowhead where that is on an outline, a dot within a face; to=[a, b] gives a leader to each (in the app: Add a leader, then drag its end). note(None, (0, 0), "(4) PLACES", dimension="corners") makes them belong to a dimension (a step’s id, or a sketch dimension’s name sketch1/d4): they stand with its text and go where it goes — under its value, turned as it is (level under a text on a leader’s shoulder), or, where under it they would cross the dimension’s own extension lines, arrows or leader, or run off the sheet’s frame, on its line after the value (.250 X 45° CHAMFER); clear of other texts where one of those places is. Never across the dimension’s own lines.
  • A detail view carries dimensions when they are sent there: show_in="<detail view id>" — any that has at least one end in the detail (with the other out of it, a half dimension).
  • p.dimension(face) of a round face is Ø if the face goes all the way around and R if it is part of a round; kind="Radius" / "Diameter" says it outright. Two round faces about one axis give how far one is off the other. An angle between two faces is the one between the walls through where they meet; supplement=True is what is left of a half turn.
  • Sections: p.op("Section", id="A", along="Plane", plane=axis("X"), offset=0.0), then section_view("secA", "A", at, of="top"): the cutting line with arrows shows in top; within 15 mm of that view’s line the section is drawn in line with it, farther off it stands where at says. p.op("Section", "A", along="Sketch", sketch=profile(s)) cuts along the sketch’s lines as far as they go (what is left of them, between their ends): a line from a hub’s middle to its rim cuts that half only, and its cutting line ends where the line does.

A step’s own size (a chamfer’s distance, a fillet’s radius) goes in any view that sees one of its edges true somewhere: a view from the side of a chamfered rim shows it where the rim turns across the view.

Angles

Angles: every angle shows its own value — a sketch’s or a step’s what it holds, a p.dimension(...) what it measures (supplement=True: what is left of a half turn) — its arc in the one of the two sectors with that value nearest its at, never the other angle. The arc runs about the apex through at; where at lies outside that sector the arc runs on past the nearer arm to the text. Where the arc between the arms is too short for the text (a small angle), the text stands outside past an arm, on the arc run on, the arrows pointing in from outside where there is no room for them either (ISO 129-1). Two lines that do not meet are drawn on to where they would (extension lines from each edge to the arc, across the apex where that lies off the part). An angle between two edges (p.dimension(e1, e2, kind="Angle")) is at the point where they cross. In a detail, an angle shows if its apex is in the detail or both its lines cross it.

Radii and diameters

Radii and diameters (ISO 129-1): the arrowhead stands on the arc as drawn (of an arc, at its point nearest the way to the text); the line runs through the arrow towards the centre; outside the round a short leader from the text, pointing in; inside, from the centre (a diameter of a whole circle across it, two arrows). at is where the text stands (in a detail too, mm on the sheet from the detail’s middle; of a round with several places alike — a bend repeated — the one whose arc is nearest at). The leader is straight and radial, ending in a level shoulder under the text: where the arc does not reach round to the side of the text (a hollow round, the text off the part), it runs from the text straight through the centre to the arc on the other side; where the text is off the radial line, the shoulder runs level from the radius to under it. A round the view hides (behind something nearer, in a view without hidden lines) gets its arrow on a short hidden-line arc where it is, and the build says it ends on a hidden edge. A length can end at the middle of an arc the view draws (a bend’s, a corner round’s): its end then counts as drawn and gets a centre mark. A diameter of a circle no view draws (a bolt circle) draws that circle as a centre line. A radius seen slantwise (a fillet on a drafted wall, within about 30° of square on) is shown as TRUE R20. p.dimension(face, datum("ZX")), p.dimension(face, axis("Z")): to the origin’s planes (“XY”, “YZ”, “ZX”) and axes — an axis is taken as the line or the plane square to it, whichever goes with the other.

Where a dimension stands

Where a dimension stands, and how it is written.

  • Every dimension call takes at=(x, y): where its text stands, in mm on the sheet from the middle of its view (s.distance(a, b, 10, show_in="top", at=(0, -40)), p.dimension(f1, f2, at=(55, 10)), p.on_sheet("fillet1", show_in="front", at=(30, 25))). This holds for a sketch’s dimensions too: at= is never in the sketch’s or the model’s coordinates, always sheet millimetres from the middle of the view that shows it (x to the right, y up), whatever the view’s scale. A text that does not fit between its arrows goes past the arrow on the side at= is on.
  • A sketch dimension’s name is <sketch>/d<n> by default (axle_hole/d10); give it one with id="width" (then axle_hole/width). Every sheet lists what it shows in <file>.wpc.views/sheet.txt, one line per dimension: its name, text, kind, what it measures and @x,y (where its text stands now) — the names to use in p.on_sheet(name, at=...). Without it the text is put clear of the view by itself and brought onto the sheet if it would fall off it. An angle’s text near its apex, a radius off its arc: say at. An angle’s arc is drawn about its apex through where its text stands (and on to it, if it stands past the arms).
  • A dimension is only shown in a view that sees it true (not end on, not askew), and in a detail only if what it measures is inside the detail’s circle. If the view you name cannot (or there is no view of that id), the build says so in the drawing’s problems (report.drawings[0]["problems"]) and uses another; a dimension that no view shows is named there too. Name a view that sees it square, or dimension an edge that view does see square.
  • An isometric view carries a length along one of the model’s axes (a bracketed (22)) when it is sent there with show_in.
  • s.radius(...)/s.diameter(...) with show_in puts that one dimension on the sheet even when its sketch is on_drawing=False.
  • Numbers: p.drawing(..., decimals=2, leading_zero=False, comma=False); an inch part writes “.750” (three decimals, a point, no leading zero) by itself, others “0,75”-style with no more decimals than needed. Any dimension takes its own decimals=.

Round things in p.dimension

Round things in p.dimension. An arc or circle edge gives R (a whole circle Ø), also a curved edge that is a circle within tolerance (the edge of a sweep along an arc); so does a face that bends as a circle one way — a fillet around a rim, a ball, a swept bend (kind="Radius"/"Diameter" to choose; plain=True writes the bare number, without R or Ø, plain=True, reference=True “(3)”). A face that bends two ways (a swept bend of a wire) has its own radius by default and the bend’s with bend="Middle", "Inside" or "Outside" (a Ø6 wire bent at R9: R3, R9, R6, R12). In a view that sees it from the side (a section of a revolved part, a front view of a ring) a radius or diameter is drawn as a length across the profile with its R/Ø; a ball’s in any view. Between two round faces about one axis: the wall or offset between them, also in a section. Between two round things that are not about one axis, or a round thing and a flat face, straight edge or datum (datum(id), axis("Z")): their near sides by default, far=True their far sides, centres=True their middles, same_side=True the far side of the one to the side of the other that faces the same way (how far a rounded end stands out past another). For things that do not lie square to each other say the direction: along=axis("Z") measures only along it, from how far the one reaches that way to how far the other does (the bottom of a bend below the top of a wire). A round face whose axis leans along that direction (the V bends of a swept wire, a tilted rod) has no sides there: it is measured by its middle — a bend’s centre point, else the point of its axis nearest the face’s middle — so p.dimension(bend_a, bend_b, centres=True, along=axis("X")) gives the 100 between two bends and never refuses; centres=True also takes a bend’s centre (not its tube) without along. A countersink’s or counterbore’s head: dimension its rim edge. report.show() prints what each dimension step measured.

Tolerances

One way everywhere: tol= on a sketch dimension (s.distance, s.diameter, s.radius, s.angle, …), on p.dimension(...) and on p.hole(...) (the bore’s diameter):

tol=drawn (ISO 129-1)
0.125 ±0,1 (an angle: 30° ±0,5°)
(0.2, -0.1) (upper, lower)25 with +0,20 over −0,10 small after it: as many decimals each, a zero deviation bare 0
limits(0.021, 0)the two limits of size stacked: 20,021 over 20,000
"H7", "N9" (a hole, upper case), "k6", "f7" (a shaft, lower case)Ø20 H7; with p.drawing(..., fits="deviations") Ø20 H7 (+0,021/0)
reference=True (instead of tol=)(60)
"exact"88 in a box: theoretically exact (ISO 1101), held only by the geometric tolerance that refers to it — a hole pattern’s pitch circle or spacing under a "Position"

A fit’s limits come from the ISO 286 tables (workpiece_core::world::fits): holes D E F G H J (J6 to J8 only) JS K M N P R S, shafts d e f g h js k m n p r s (r and s by the finer size ranges above 50 mm: 50–65, 65–80, …), grades 5 to 14, sizes to 500 mm. A class or size not in them fails the step (no guess); so do tol= together with reference=True and an upper deviation below the lower one.

s.diameter(bore, 20, tol="H7")                  # Ø20 H7
s.distance(a, b, 6, tol=(0, -0.03))             # key width 6 with 0 over −0,030
s.distance_u(c, d, 40, tol=0.05)                # 40 ±0,05
p.dimension("seat", tol="k6", show_in="front")  # Ø20 k6 of a turned face
p.hole(s, 8, tol="H7")                          # Ø8 H7 (a bore's fit: not class=)
s.diameter(pitch, 88, tol="exact")              # Ø88 boxed: the holes' position is toleranced
p.datum_feature("A", on=topo("base"), show_in="front", at=(0, -40))
p.geometric_tolerance("Flatness", 0.05, on=topo("base"), show_in="front")
p.geometric_tolerance("Perpendicularity", 0.02, on=topo("bore"), datums=["A"], diametral=True)
p.geometric_tolerance("Position", 0.1, on=topo("hole1"), datums=["A", "B"], diametral=True)
p.drawing(..., general_tolerance="ISO 8062-3 DCTG 9")   # a casting; None: no general tolerance

Datum features (p.datum_feature, ISO 5459) draw their letter in a square on a leader ending in a filled triangle on the face’s outline; geometric tolerances (ISO 1101) a frame of compartments — symbol, zone (Ø with diametral=True), datums in order — on a leader ending in an arrow on the face’s outline. Both are placed like dimensions (show_in=, at=(x, y) in mm from the view’s middle, or p.on_sheet(id, ...)).

Where the leader ends: on the outline the view draws of the face (never in a hole’s gap of a ring face), near the frame; a frame close in front of the outline is reached from its end; two on one face end apart. to=(x, y) (mm from the view’s middle, like at=) steers it: the point of the face’s drawn outline nearest that. A round face (bore, shaft) is an axis: a datum on it always (ISO 5459), a tolerance for position and concentricity, and straightness, parallelism, perpendicularity, angularity with diametral=True (ISO 1101 derived feature). Its leader ends on the extension of that face’s diameter dimension line, in line with the dimension’s arrow, where the view shows that diameter (put a p.dimension(face, kind="Diameter") or a sketch diameter in the same view, measured on that face: a diameter as large on another seat of the shaft is not it) — seen from the side or, where the view looks along the axis, across its circle (a hole’s callout to its rim too): the arrow on the other side of the circle, in line with the dimension’s line through the middle; to= picks the end of that line. Without such a dimension in the view, where the view looks along the axis, on its circle (of a pattern’s holes, the nearest to the frame), the square or frame put off the circle by itself. A datum letter is a capital, never I, O or Q; a characteristic of form (straightness, flatness, roundness, cylindricity) takes no datum, the others need the datums named before them. The title block’s “General tolerances” cell says the sheet’s general_tolerance= (default “ISO 2768-mK”; the app: the sheet’s properties) where the sheet gives a size it holds of — a dimension or a hole’s callout with no tolerance of its own (not in brackets, not boxed); an assembly’s sheet of balloons only, or one whose every size is toleranced, leaves the cell empty. Its “Sheet” cell numbers the part’s drawings in order (1/2, 2/2), and every sheet gives the part’s mass (a flat pattern laid out beside it is not weighed).

Surface texture

p.surface_texture("Ra 1,6", on=topo(face), removal=True, show_in="front", at=(x, y)) says how rough a face may be (ISO 21920-1, drawn with the ISO 1302 graphical symbol): two legs 60° off the surface, the shorter 1,4 × the lettering high, the longer 3 ×, a line on from its top over the requirement. removal=True (default) material is to be removed — a bar closes the legs; False it must not be — a circle in them; None any process — the bare legs. The symbol stands on the face’s outline where the face looks up in the view and at is right over its edge (its apex there); else on a reference line at at with a leader ending in an arrow on the outline (a dot where the view sees the face square on); to=(x, y) steers where the leader ends, as for tolerances. p.drawing(..., surface_texture="Ra 6,3") writes the requirement of every other face over the title block at its right, its symbol followed by the basic symbol in brackets (√Ra 6,3 (√): “all others as this”). In the app: Annotate → Surface.

p.surface_texture("Ra 0,8", on=topo(seat), show_in="secA", at=(30, 12))      # ground seat
p.surface_texture("Rz 25", on=topo(flange_back), removal=False, show_in="front", at=(-40, 20))
p.drawing(..., surface_texture="Ra 6,3")

Views of some bodies

Views of some bodies, sections of the cut only. view(..., bodies=["plate"]) (also projected, section_view) shows only those bodies: one body of several per view. section_view(..., cut_only=True) draws only what the cut meets, hatched, with its outline.

Where a dimension stands by itself

Where a dimension stands by itself (no at): clear of what stands on the sheet already — in any view — of the views’ names and letters, and of the other views; a length goes to the other side of its view where the near side is taken by another view; two radii about one middle get leaders of their own. A fillet’s or chamfer’s size is drawn at the corner nearest its at. Extension lines start at the outline nearest their dimension line (with the sheet’s gap), not where on a face the length was taken.

What the build reports

What the build reports (report.drawings[0]["problems"]): besides a dimension no view sees, a dimension ending on an edge its view hides (draw the view HiddenDashed) or on nothing it draws, an extension line or leader longer than 80 mm, texts written over each other, a text or a view on the title block, a section that could not cut a body; two parallel lengths over a common stretch closer than a line of lettering (stack them 7 mm apart, the shorter inside), a leader that runs across another view, a dimension’s text on an outline, a view’s caption that cannot be moved clear of what is drawn there. Read them; a sheet a draughtsman accepts has none. Placed by itself, a length goes 10 mm off the outline and 7 mm on for each next one, the shorter inside the longer; no text of a dimension crosses its view’s lines nor stands past the sheet’s frame; a hole’s callout turns round its hole to keep its leader off other views; lines and hatching are broken where a dimension’s text stands on them; a caption moves up to 8 mm off a line or text drawn over it.

p.build(path, render=True) writes path.views/<drawing id>.png (also .pdf, .svg) and one image per view, view-<id>.png: look at it beside the original — same views in the same arrangement, same dimensions with the same values, none extra, none missing. Compare first as text: report.sheet() and the scorecard (next section).

Several parts and assemblies

Rule: a drawing whose parts list has several items is modelled as one standalone part per item, plus an assembly that places them — not as several bodies of one part. A box with two dividers is box.wpc and divider.wpc (placed twice), and box_assembly.wpc. Each part has its own material, mass and drawing; the assembly only places them.

from workpiece import Part, anchor, placed, topo

plate = Part(material="Aluminium", file="plate.wpc")   # modelled as any part
...
pin = Part(material="Steel", file="pin.wpc")
...
asm = Part()                                              # the assembly: no bodies of its own
asm.add_part(plate, id="plate")                           # Fixed where it was modelled
asm.add_part(pin, id="pin1", at=(-20, 0, -5))             # the same part file, placed twice
asm.add_part(pin, id="pin2", at=(20, 0, -5), euler=(0, 0, 90))
report = asm.build("out/pinned_plate.wpc")              # builds plate.wpc, pin.wpc there first
report.show()
for m in report.masses:                                   # per placed part: name, file, material,
    print(m["name"], m["file"], m["mass"])                #   volume, mass (kg)
print(report.mass_total)                                  # all of it (kg)
  • add_part(part, ...) takes a Part(file=...) of the script (built into the assembly’s folder first, once however often it is placed; its report is asm.reports[file]) or the name of a .wpc file already in that folder. The step’s id names the placed part.
  • Where it goes: without mates it is fixed (fixed=False: free to drag) with at=(x, y, z) (where its origin goes) and euler=(x, y, z) (degrees about the fixed x, y, z axes, in turn); or held by mates=[...], each mate(onto, with_, constraint, flip_onto=, flip_with=, offset=, angle=, distance=): onto=anchor(topo(face), "FaceCentre", instance="plate") (a face of a part placed before), with_=anchor(topo(face), "FaceCentre") (one of the placed part’s own), and the constraint between them — "Fastened" (default), "Revolute" (concentric and coincident), "Slider", "Cylindrical", "Planar", "Ball". flip_with=True turns the part’s reference over, to have two faces face each other (a pin standing on a plate); flip_onto=True turns the other. Two mates hold what one leaves free (a revolute mate on an axis and a second one off it). Snaps: “Datum”, “FaceCentre”, “FaceAxis”, “EdgeMiddle”, “Vertex”, “ArcCentre”. The joints are named after the step (the second mate’s id/2), for Drive and Mechanism.
  • Standard parts: standard_part(kind, size, length=None, mates=..., id=...) — kinds “HexScrew”, “SocketScrew”, “HexNut”, “Washer”, “DowelPin”, “Bearing”. Each has a seat, the frame seat() on its axis where it naturally sits, z into it (a screw’s ring under its head, a nut’s or a washer’s face, a pin’s end, a bearing’s side face): mate(anchor(topo(top), "FaceCentre", instance="plate"), seat(), "Revolute", offset=(x, y, 0)) stands it on that face.
  • Off the reference’s middle: offset=(x, y, z) holds it that far off onto, in that reference’s own frame — for a face, x and y in its plane (along the part’s x and y for a top face) and z along its normal — after the joint lines the two up. For a face, x and y are the face’s own axes (for a flat face parallel to the XY plane they follow the model’s x and y), so the first number runs along that axis, not always along the part’s long side. A divider fastened onto a floor 32 off the floor’s middle is one step, no helper frame: asm.add_part(divider, id="divider1", mates=[mate(anchor(topo(floor), "FaceCentre", instance="box"), anchor(topo(foot), "FaceCentre"), flip_with=True, offset=(32, 0, 0))]). A step after the joints (a dimension, a drawing, a cut across parts) sees each part where its joints hold it, as the report does.
  • Picking faces of placed parts: report.placed lists each placed part (name, file, pose, material, volume, mass, bodies with faces and edges); report.faces(placed="pin1", near=(-20, 0, 25)) picks among that part’s faces by where they are in the assembly; the names are the part’s own. Refer to one from a step of the assembly with placed("pin1", topo(name)) (e.g. asm.dimension(placed("pin1", topo(a)), placed("plate", topo(b)))).
  • Mass: with the part’s material known to the folder’s materials.json (or the built-in library: Steel, Aluminium, Brass, Oak, ABS, …), report.masses / report.mass_total weigh it. A material the library does not have: material(folder, "Cherry", 560) adds it (kg/m³) to that folder’s library before building; or compute it yourself with report.mass(density, placed="pin1").
  • A drawing of the assembly (asm.drawing(...)) shows the placed parts as a part’s drawing shows its bodies; each part’s own drawing goes in its own script part.
  • add_part(..., bodies=[...]) takes only some of a part’s bodies: that is for splitting an existing part after the fact, not for parts you model — do not use it in these scripts.

See examples/pinned_plate.py (a plate and a pin placed twice, masses checked by hand).

Checking against the original

The build can tell most of what a grader would find, as text, before any picture is opened.

Declare the original once (whoever first reads the drawing; later passes and the grader reuse it):

p.expect(original(
    views=[("top", "Top"), ("front", "Front"), ("secA", "Section"), ("iso1", "Pictorial")],
    numbers=[92, 4, 9, 60, "R32", "Ø50", "(9)", "45°"],     # every dimension, one entry per occurrence
    notes=["(4) PLACES", "THRU", "CL SYM"],                   # words printed on it, one per occurrence
    mass=(450.0, 0.3, "g"), units="mm", decimal="."))        # (expected, tolerance, unit); units "in" drops leading zeros

View kinds: Front Back Left Right Top Bottom Pictorial Section Detail Auxiliary (ids are yours; kinds are compared). Numbers are compared as printed (R, Ø, °, brackets for reference dimensions); counts ((4) PLACES, 4×) are notes, not numbers. For a multi-part script put expect on the part whose sheet stands for the original’s (the assembly).

The scorecard (report.show(), report.score["line"], <part>.wpc.views/score.txt): views 6/6, numbers 21/25 (missing: 18, (9), R6, 60), extra: 5.4; notes 3/5 (missing: ...); mass ok (450.016 g vs 450 ± 0.3); problems 0, ends off geometry 2. Views by kind (missing / extra views also appear as lint), numbers of the original not on the sheet and numbers on the sheet not in the original, notes, mass in tolerance, number format (comma, leading zero), the sheet’s problems, and dimensions whose ends are not on drawn geometry. A producer works to a clean scorecard and clean problems; a grader opens images only for what it cannot judge (placement, legibility, right geometry).

The sheet as text — report.sheet() (also <part>.wpc.views/sheet.txt, every build):

view front  [Front] Front  1:1 HiddenDashed  at 110,165  size 127,69.85  box 38.5,113.07..217.3,221.43
  dim front/d54  ".875"  length  sketch front: distance p8 to p7 along U  ends ok  @-33.34,-49.18
  dim front/r50  "R.50"  radius  sketch front: radius of a2  ends -  @102.15,-43.25
  words "(2) PLACES" of front/r50  @122.07,-43.25
  line axis of cross "CL SYM"  -66.5,0 -> 66.5,0

One line per item: view id, kind (Front/Top/…/Pictorial/Section/Detail/Auxiliary), what it is of, scale, style, place and box on the sheet (mm); per dimension its id, text exactly as printed, kind, what it measures (a sketch dimension: the two points or curves by name; a p.dimension: the references), ends ok or ends OFF 0:3mm (the end is that far from any drawn line or round: the dimension points at nothing drawn), where its text stands (mm from the view’s middle); words, centre lines, cutting lines with their letters, balloons (item numbers), parts-list rows, and the sheet’s problems.

Lint of the script (in report.lint, printed by show()): a typed number that is not among the declared numbers but is a sum, difference or half of them (“the value 79 is not on the drawing: it looks like 92 − 4 − 9; model it from those numbers”); private members of the layer used (p._steps, rep._pick); a script reading its own output files before building; and the view kinds against the declaration.

Pictures without hand work

  • p.build(path, render=True) writes <path>.views/view-<id>.png per view (the view’s box plus its dimensions, about 1200 px on the long side) beside drawing1.png / .pdf; report.view_images lists them. Open the one view that changed, not the whole sheet.
  • python -m workpiece.tools crop sheet.pdf x y w h -o out.png — a box of a sheet PDF in mm from its lower left corner (the at / box numbers of sheet.txt); on a PNG/JPG the box is in pixels from the upper left. Python: from workpiece import crop; crop(path, (x, y, w, h), out). -m 5 widens the box.
  • python -m workpiece.tools tile original.png --grid 3x2 -o tiles/ — overlapping tiles at 2x (tile-r1c1.png …; tiles.txt says where each lies in the original’s pixels): read the original’s small text once, then reuse the tiles. Python: tile(path, (3, 2), out_dir).

Speed: report.seconds / the last line of show() say where the time went (steps, drawings and lint, pictures). A build of what an earlier build of the same path already built (same recipe, and the parts it places) is not done again (report.reused); render defaults to False — ask for sheets and view images only on the build you are going to read; the four iso/front/top/right pictures are written only for a part without a drawing (pictures=True forces them). The workpiece command line: workpiece make recipe.json -o x.wpc --report r.json [--times] [--render dir [--no-pictures]]; the report’s drawings[i]["inventory"] is the sheet as data.

What a good model is (what is checked)

  • Every sketch fully constrained: report.sketch(id)["degrees_of_freedom"] == 0, and the lint list has no sketch in it. Give the dimensions the drawing gives, as driving dimensions (distance, distance_u, distance_v, radius, diameter, angle, point_line), and geometric constraints (horizontal, vertical, tangent, coincident, symmetric, equal, …) — not computed coordinates. Coordinates are only the solver’s starting guess: give a rough but plausible guess (right side, right order of magnitude).
  • No repetition that is a pattern or mirror: one feature plus a Pattern (of features, or of="Bodies"), or a Mirror for a symmetric part, not the same feature several times. Lint flags three or more alike steps.
  • As few steps as do it, with the ordinary operations a person would use (extrude, revolve, hole, fillet, chamfer, shell, rib, draft, pattern, mirror…).
  • The mass is right within the drawing’s tolerance.
  • The drawing matches: a sheet with the original’s views and dimensions (see above).

If an operation does not behave as a CAD user would expect, fails on valid input, or is missing, do not work around it silently: report it (what you called, what happened, the error text) — it will be fixed.

Conventions

  • Sketch planes p.sketch("XY" | "YZ" | "ZX") are the origin’s planes; (u, v) of the sketch is (x, y) on XY, (y, z) on YZ, (z, x) on ZX — on ZX u is z and v is x (there is no “XZ”). datum(id) sketches on a datum plane a step made (p.plane("Z", 20) → the plane parallel to XY at z = 20); topo(face) on a flat face.
  • In a sketch s.origin is the fixed point (0, 0); "u" and "v" are the plane’s axes as construction lines (for point_on, symmetric, point_line, angle, parallel). Lines that share a point name are joined there; separate points need coincident.
  • Dimensions take their side from your starting guess. distance_u(a, b, 20) says a and b are 20 apart along u; which of them is to the right is as you placed them. Values are positive. So place points on the right side of each other, roughly where they belong.
  • angle(a, b, degrees) is from line a to line b, counter-clockwise, each line taken from its first point to its second. If a sketch will not solve or solves into a mirrored shape, an angle (or a guess on the wrong side) is the first suspect: swap the lines, or draw the line the other way round. report.sketch(id)["points"] shows where everything ended up.
  • Projecting the model into a sketch: s.project("rim", edge_name) (names from a report) gives fixed construction geometry that follows the model — the curve "rim" and its points "rim_a", "rim_b" (an arc: rim_center, rim_start, rim_end; a vertex: the point "rim"). Constrain against it (point_on, coincident, tangent, distance) so a line ends on a body’s edge without a number being repeated.
  • A sketch on a face (topo(face)) takes its axes from that face, not from the world: on a face that looks along −x, (u, v) is (y, −z). Check with one point and report.sketch(id)["points"] against the built body before drawing a whole profile; a datum plane (p.plane("X", -30)) keeps the world’s directions.
  • Extrude up to a face (p.op("Extrude", sketch=profile(s), extent="ToFace", up_to=topo(face)), or up_to=datum(plane_id): it ends at that face’s plane, on past the face’s own rim, whichever way from the sketch that is. extent="ToNext" ends a cut where it first comes out (through all of the first wall, also where the profile crosses a gap).
  • A blind hole ends in a 118° drill point; point=180 makes its floor flat.
  • Tapped holes (kind="Tapped", size="M8", fine="1" for M8×1): depth is the tap drill’s bore; the thread goes thread_depth deep (default 1.5 × d, the workshop’s rule — 1 × d is enough in steel, 2 × d wanted in aluminium), or thread_through=True through all of a bore that goes through (no depth). By the rule the bore is half d deeper than the thread: tap_depths("M8") is (12.0, 16.0), so p.hole(s, 8, depth=16, kind="Tapped", size="M8"). A thread deeper than its bore, or through all of a blind bore, is an error. The drawing shows the thread as ISO 6410-1 has it, and the callout says M8 ↧12 over Ø6,8 ↧16, or M8 THRU.
  • Holes go at the dots of a sketch: d = s.dot(u, v), dimension it, p.hole(s, 6) (place="Sketch"; a dot per hole). Or on a face without a sketch: p.hole(None, 6, on=topo(face), off=[(topo(side), 10), (topo(edge), 15)]) (a distance from each of two planes, flat faces or straight edges — from a face of the body or an edge of the face drilled, inward), around=axis("Z"), radius=20, angle=30 (from an axis, the angle from the face’s x), or at=(x, y) (a point of the face’s plane, in its own x and y). With no depth a hole goes through everything that way, bodies beyond included: give depth= or target=topo(body) when it should stop. A depth that is dimensioned elsewhere on the drawing is no number: p.hole(s, 6, up_to=datum(plane_id), offset=0) (or topo(face)) ends the bore at that face’s or plane’s plane (offset further in, negative short of it), and a counterbore’s floor likewise, kind="Counterbore", head=11, head_up_to=datum(plane_id); the callout then leaves that depth out (it is dimensioned elsewhere), or with reference_depths=True on the drawing shows it in brackets, as a reference. next=True ends it where it first comes out. Cuts and joins take target=topo(body) too when several bodies overlap.
  • Every wrapper takes id= to name its step (p.fillet(edges, 2, id="rim")); names of faces and edges start with the id of the step that made them and change when an earlier sketch is redrawn or a pattern copies them (pattern1/1/…): list them again after such a change.
  • Helpers: rect, polyline, slot (obround), polygon (dimensioned across flats). A rect is already horizontal/vertical: adding symmetric on top says some things twice — lint lists such redundant constraints; drop one of the two.
  • Patterns: p.feature_pattern([face_of_the_feature], count, about=axis("Z"), angle=360). A full turn is shared out evenly; over less than a full turn the first and last copy sit at the ends (3 over 180° are 90° apart). along=axis("X"), spacing=… for a row. points=sketch puts a copy at each dot of a sketch (moved there from where the feature is; none at a dot where it is already). fill=topo(flat_face), grid="Square"|"Rectangular"| "Staggered"|"Hexagonal"|"Rings"|"Polygon", spacing=, across= (rows or rings apart), sides=, turned= (degrees), margin= fills the face from where the feature is, leaving out what would cross its edges or the margin. p.pattern(body_name or [names], …) repeats whole bodies (the same ways; combine="NewBody"|"Join"|"Cut", target= to cut). One step, Pattern, does both: of="Features" with features=[faces], or of="Bodies" with bodies=[...].
  • Mirrored features: p.feature_mirror([face_of_the_feature, …], "Y") (a datum plane datum(id) or a flat face topo(face) also do) mirrors what the steps of those faces added or cut (a pocket with its fillet: one face of each step) in one step; what they make is named {id}/…. p.mirror(body_or_names, "Y", join=False) mirrors whole bodies (one step, Mirror, of="Features"|"Bodies").
  • Planes from a face (p.plane(topo(face), d)) have the face’s own axes, the same as a sketch on the face: normal out of the body, origin = the world origin projected onto the plane, and “up” up: v is world +z projected onto the plane (normalised), u = v × normal, so the sketch reads the right way round seen from outside (a face looking along −x has u = −y, v = z). A top face (normal +z) has u = x, v = y; a bottom face (normal −z, seen from below) u = x, v = −y.
  • Cuts turn towards the body by themselves; through=True, symmetric=True cuts through everything both ways.
  • Arcs run counter-clockwise from start to end about their centre (cw=True for the other way). An arc’s radius is free until dimensioned or its ends are otherwise fixed.
  • Extrude goes along the plane’s normal (flip=True the other way), symmetric=True both ways, through=True through everything; combine is “NewBody”, “Join”, “Cut”, “Intersect”.
  • Which areas of a sketch an extrude (revolve, emboss) takes: areas=[(u, v), …], a point inside each area in the sketch’s (u, v) — p.extrude(s, 5, areas=[(10, 5)]), or p.op("Extrude", …, areas=[(10, 5)]). The point is looked up in the sketch as built, so it keeps working when curves or points are added to the sketch; put it well inside the area, not on a curve. Left out, the whole sketch is taken (areas inside others are holes). Areas picked in the app are saved by their boundary ([{"entity": "e7", "left": true, "at": 0.5}], entity ids that shift when the sketch is redrawn): in a script, use points.
  • Every other step: p.op("Kind", **arguments); run workpiece kinds for all kinds with their arguments as by default — only say what differs. References are profile(sketch), topo(name), datum(id), axis("Z").
  • Names of faces and edges come from the steps that made them and are stable across rebuilds as long as those steps do not change; get them from the report, do not guess them.

Architecture

A map of the crates and of how a part is built, for someone who wants to find their way in the code. Everything here was read from the code; the crate-level doc comments (//! at the top of each lib.rs) say more, and cargo doc --workspace --no-deps --open shows them.

The idea

A part is a program: an ordered list of operations (also called steps) with arguments. Applying the operations in order to an empty world gives the part’s geometry. The program, the parameters and a cache of solved values are what is saved in a .wpc file (JSON); geometry is never saved, it is rebuilt.

A step never depends on a later step: a step sees only what the steps before it made. Across parts, a part never contains itself; building a part that is already being built fails.

Crates

Dependencies point downwards in this list.

LayerCrateRole
corecore (workpiece-core)The world, references, the Operation trait, the Builder trait, the Cache, the Registry, widgets and handles (what a dialog and the viewport show while a step is edited), units, measures with formulas, rigid poses.
corecore/derive#[derive(Arguments)]: from the fields of an operation’s arguments it finds what they refer to and makes the default dialog.
liblib/booleanBooleans of solids over tolerant NURBS B-reps: finds where boundaries meet, cuts the faces, keeps the pieces. A boolean it cannot do exactly is a Refusal with a reason.
liblib/shapeGeometry that several operations share: sweeps and lofts, blends (fillet, chamfer), thickening, shelling, drafting, healing, surfaces, splitting, threads.
liblib/solverThe geometric constraint solver of sketches: Newton iteration with exact derivatives, least-motion solutions, diagnosis of degrees of freedom, redundant and conflicting constraints.
liblib/renderA small path tracer for the Render step.
opsops/*One crate per family of operations. Each has a register function that tells the registry its operations. See below.
cadcad/cad-partPart, Workspace (parts by path), Engine (builds parts, with caching), the thread pool, naming fallback, material library, properties.
cadcad/cad-uiThe application as data: Model (all state), View (derived from the model each frame), Message (what the view asks for). No window.
cadcad/cad-rasterizeTurns built worlds and edit handles into triangle, line and point buffers for drawing and picking.
hosthosts/appThe desktop application: egui for the interface, OpenGL (glow) for the viewport. Reads and writes files; the model does not. The same crate compiled for wasm32-unknown-unknown is the application in the browser (src/web.rs, built by website/app/build.sh).
hosthosts/cliThe workpiece command: make, report, kinds, materials.
benchbench/boolean, bench/conformanceBenchmarks, outside cargo test.

The operation crates (ops/): basic-shapes, sketch, sweep, features (holes, threads), blend, faces, bodies, datum, surface, sheet-metal, annotate, drawing, appearance, mesh, step (STEP, IGES, STL and 3MF in, STEP, IGES, STL and 3MF out), instances (placing parts, joints), standard (screws, nuts, washers, bearings). ops/testing is only for their tests.

The world

core/src/world holds everything a part is made of:

  • topo: one boundary representation, a coedge-based B-rep (Body, Lump, Shell, Face, Loop, Coedge, Edge, Vertex) in arenas with typed ids, with NURBS geometry only (no analytic surface types), one scalar tolerance per vertex, edge and face, and persistent names.
  • Datums (planes, axes, frames), profiles (a sketch’s solved curves and the regions they bound), annotations (dimensions, tolerances, notes), looks (materials and colours), threads, views and visibility.
  • Instances of other parts, joints and couplings (assemblies).

Operations, builder, outputs

An operation implements the Operation trait (core/src/operation.rs): an id, Args, an optional EditState (the tool in use while editing, not saved), and one of

  • make(&self, builder) -> Made: for operations that only create things. Made lists what is made: bodies (by name), datums, profiles, annotations, looks, instances, joints, what to keep in the cache, and which bodies are removed. The builder puts it into the world. The operation changes nothing itself.
  • apply(&self, builder): for operations that change the world in place.

The Builder trait is what an operation sees: the world, the cache, the part’s parameters, the other parts (build(path)), and the earlier steps. Reads go through the builder, which can note them in a Trace (what the step read and which bodies it wrote). Two implementations: the engine’s (in cad-part), and Standalone, which applies operations to a lone world for tests.

References (core/src/reference.rs) point into the world by name, never by arena id, and are typed by what they must resolve to (Reference<DatumPlane> accepts a datum plane, a frame’s plane or a planar face). Faces and edges are named after the operation that made them (extrude2/side/e7). Renaming a step follows through its references.

Naming fallback (cad/cad-part/src/naming.rs): when the history upstream changes so that a named piece comes about another way, the part’s cache remembers where each referred piece was, and the nearest piece of the same kind is taken in its place if it is clearly the one. Otherwise the step fails.

The cache

Cache (core/src/builder.rs) is a map from names (sketch1/p3) to numbers: what an operation solved the last time (a sketch’s points, an assembly’s poses). It is an input of the build, saved in the part file: constraints often have several solutions, and the one a build finds depends on where it starts. Once it holds a solution, that solution stays the starting point. It is not a disposable memo table.

The engine

cad/cad-part/src/engine.rs builds parts and no more than it must.

  • Everything is keyed by what it is made from: the steps so far (their arguments), the parameters, the cache entries the steps start from, the placed parts (recursively) and the files read. These are hashed into a key, step after step, and the world after every step is kept under its key. A build finds the longest kept prefix of its steps and applies only what comes after.
  • A step is skipped even inside that when what it read (from the Trace) is unchanged; effect.rs keeps what a step did so it need not be applied again.
  • Parts that a part places are built side by side on a work-stealing Pool. A Cancel stops a build at the next checkpoint a step passes; a step that panics is a step that failed.
  • Poses of an assembly (worked out from joints) are computed after the last step on a copy, so dragging a part does not invalidate what is drawn.

The registry

core/src/registry.rs: each operations crate has register(&mut Registry), which says, for each operation, its kind (the name steps have in the file), the tools that add it (label, icon, hotkey, ribbon tab and place) and the icons it draws. cad/cad-part/src/any_operation.rs calls every crate’s register once and installs the result. Nothing else lists the operations: a part holds its steps as AnyOperation, which is any registered operation. Adding an operation means writing it in a crate and registering it there (and adding the crate to that list if it is new).

From click to picture

In the app, each frame cad-ui derives a View from the Model; hosts/app draws it with egui. What the user does becomes Messages that are applied to the model after the frame. The model edits the part’s program, asks the workspace to build it (Workspace::build, via the engine), and cad-rasterize turns the world into buffers that the host draws. Previews of a step being edited are built the same way on a copy.

In the browser

hosts/app compiled for wasm32-unknown-unknown runs in a page (eframe’s web runner, WebGL 2 through the same glow renderer). What differs is said in a few places, not spread through the code: workpiece_core::files reads and writes the files the user names, on disk or (in a browser) in memory, which is what the kernel’s own reads (a placed or imported STEP file) go through too; workpiece_core::HAS_THREADS says whether work can go to threads (the engine’s pool, the drawing’s views, the previews, the path tracer) or is done on the one thread there is; and hosts/app/src/web.rs has the page: opening by ?open=, picking local files, downloads, the start screen with the examples, the settings in local storage. Without threads a build runs as it is asked for, on the page’s thread. The standard library for this target is built with panic=abort, so a step that panics ends the page (it says so) instead of failing as a step.

The command line and Python

hosts/cli reads a JSON recipe (steps compactly, sketches by named points with constraints), builds the part through the same workspace, and prints a report: failed steps with reasons, each sketch’s degrees of freedom, volumes after every step, and the named faces and edges. python/workpiece/ (the workpiece package) writes recipes from Python and reads the report back.

Where to start

ToRead
add a modelling operationops/basic-shapes (small), core/src/operation.rs, then register it in the crate’s lib.rs
change the geometrylib/shape, lib/boolean (lib.rs explains the method)
understand a sketchops/sketch, lib/solver
change what the app showscad/cad-ui (state and view), hosts/app/src/ui (drawing)
see how builds are reusedcad/cad-part/src/engine.rs, effect.rs

Benchmarks

Workpiece is measured with three benchmarks that other people wrote or that are public data. This page says what each one is, where it comes from, how to reproduce Workpiece’s numbers, what they are, and what other projects’ numbers are known and from where. The numbers are in results.json, which a script regenerates from a run (below).

Summary

BenchmarkWhat it gradesWorkpieceScored by
brep-conformance 2.0.1all 3650 cases, the 33 that read NIST’s STEP files included: booleans, constructions, queries, modify, fillets, chamfers, STEP, parts, at 1e-7 mm3650 of 3650Workpiece (self-scored; the suite’s authors have not reviewed Workpiece’s adapter)
The boolean bench1917 cases: closed-form booleans, near misses, random pairs, brep-bench’s cases, 675 public STEP files1902 pass, 12 refused, 3 wrong, 0 crashedWorkpiece (self-scored)
step-conformance27 STEP parts at four mesh tolerances (108 cells)105 of 108Workpiece’s port of the benchmark’s rule (self-scored); not the benchmark’s own scorer

Run on 2026-11-25 (brep-conformance: the whole suite again on 2026-11-26). On brep-conformance, springrep also passes every case (the maintainers’ run of all 3650, and reproduced here on the 3617 without NIST’s files), cadrs passes 3648 of 3650, and the other kernels in the maintainers’ published runs pass fewer. On step-conformance, Workpiece is level with three published readers at 105 cells, and one published reader (ogeom) passes two more. Details, and where Workpiece is weak, follow.

What the benchmarks are

brep-conformance

brep-conformance is a kernel-neutral conformance suite for B-rep kernels, published with the kernel springrep. It drives a kernel through an adapter (one JSON request per line on stdin, one reply per line on stdout) and judges each case at 1e-7 mm; a kernel’s headline is the share of all cases it passes at that tolerance, and cases a kernel does not support count against it. Its categories: booleans (1253 cases), constructions (448), queries (320), modify (612), fillets (627), chamfers (171), step (163, of which 33 read NIST’s STEP files), parts (56).

Workpiece’s adapter is in bench/conformance. Per the suite’s rule it answers each function with the kernel’s one call for it and adds nothing. The suite’s maintainers publish results for the kernels in their registry, each run by them on one bare-metal machine; their runs of a kernel use an adapter they reviewed. Workpiece is not in their registry, so its row is self-scored: made here, with an adapter they have not reviewed.

The boolean bench

bench/boolean is Workpiece’s own suite for its booleans and STEP importer. It is not a third-party benchmark; it is here because it uses public data and outside case sets, and everything in it can be rerun. Each case is graded as in brep-bench: pass (a valid closed solid, volume and area to a relative 1e-6, measured from the surfaces, not from a mesh), refused (the boolean declined, with a reason), wrong, or crashed. Its cases:

  • hand-made cases with closed-form answers (box, cylinder, sphere, turned, coincident, tangent, nearmiss, chain, random, features);
  • the boolean, tangent, fillet, chamfer, geometry, parts, NURBS, spline, singular, primitives, sweep, loft, swept, feature, edit, offset, shell, thicken and draft cases of brep-bench (MIT OR Apache-2.0; its results are at brepbench.org), as of its snapshot of early November 2026, built by Workpiece’s own port of each case and graded by brep-bench’s rule;
  • 675 STEP files that must import as valid closed solids (step-import), and parts of them halved, drilled and combined (step).

The STEP data is fetched by boolean-bench fetch and pinned by SHA-256 in datasets.tsv: the CTC, FTC and STC parts of NIST’s MBE PMI validation and conformance set, samples of the KiCad 3D model library (CC-BY-SA 4.0 with an exception), of the FreeCAD library (CC-BY 3.0), and the parts of step-conformance (CC0).

step-conformance

step-conformance (code under MIT or Apache-2.0, parts CC0) measures STEP importers: 27 parts (7 shop parts, a freeform panel, 19 generated parts of known shape), each read and meshed at 0.0125, 0.05, 0.1 and 0.5 mm, 108 cells. A cell passes if the mesh has every face of the file, reaches no further than the file’s geometry, and is within four tolerances of the true surface both ways, in under 60 seconds. Its maintainers publish a table of readers (below).

Workpiece’s cells are scored by bench/boolean/src/conformance.rs, Workpiece’s own implementation of that rule, not by the benchmark’s scorer. For the shop parts the benchmark’s reference is OpenCascade’s fine mesh; OpenCascade is not run here, so Workpiece’s own fine mesh stands in. Those 28 cells therefore check Workpiece against itself and against the file’s facts (every face, nothing outside the file’s geometry, every vertex reached), which is weaker than the benchmark’s check. The other 80 cells have an exact truth and are scored as the benchmark scores them. (Workpiece was run through the benchmark’s own scorer once, on 2026-11-13, at commit 6693c37 of step-conformance, which gave the same 105; that run is not repeated here.)

Workpiece’s results

The runs of 2026-11-25, and the whole brep-conformance suite again on 2026-11-26 (below). Machine: AMD Ryzen 9 7950X (16 cores, 32 threads), 124 GB, Ubuntu 22.04.5, Linux 6.8.0; the machine was shared with other jobs (load average 6 to 28), so times are indicative. Workpiece was built from commit 450425c plus uncommitted changes (rustc 1.97.0-nightly, release profile). The suite and springrep were built with Rust 1.99.1 in the sandbox described below.

brep-conformance

Suite 2.0.1 at commit dc7ac9e, the one the maintainers’ runs below were made on. The whole suite, all 3650 cases, in one run on 2026-11-26 with --nist (the 33 cases that read NIST’s STEP files are opt-in in the suite; the files were downloaded with the suite’s own checksum-verified nist/fetch.py), seed 1, 120 s per call, 14 workers, judged at 1e-7 mm: 3650 of 3650: booleans 1253, constructions 448, queries 320, modify 612, fillets 627, chamfers 171, step 163 (the 33 NIST cases included), parts 56; none unsupported, refused, timed out, failed or crashed. Workpiece does not answer four functions (inertia, betti, section_area, mesh); no case was counted as unsupported for lacking one.

The two earlier runs of 2026-11-25, without the NIST cases (3617 cases), gave 3617 of 3617; the medians per category below are from those two runs, made back to back with springrep in the same sandbox:

categorycasesWorkpiece at 1e-7 mmmedian ms, run 1 / run 2
booleans1253125347.9 / 86.9
constructions448448131.2 / 133.6
queries3203200.5 / 0.7
modify6126125.9 / 6.2
fillets6276274.3 / 4.5
chamfers1711711.8 / 1.9
step (without NIST)1301300.4 / 0.5
parts565614.4 / 18.2
all3617361722.1 / 28.1

No case failed, was refused, timed out or crashed. A whole run of the 3617 took 55 s and 68 s of wall time (the run of all 3650: 53 s). springrep 2.1.0 (the maintainers’ adapter, reproduced here in the same sandbox, back to back) took 57 s and 71 s and passed all 3617 as well; its medians in the same two runs were: booleans 44.5 / 44.8, constructions 166.6 / 177.8, queries 1.1 / 1.2, modify 2.2 / 2.2, fillets 3.4 / 3.5, chamfers 1.2 / 1.3, step 0.5 / 0.5, parts 14.2 / 14.6, all 11.8 / 11.9. On this machine Workpiece’s median was lower in constructions and queries and higher in modify, fillets and chamfers, and the all-case median was higher. Neither kernel is faster in every category, and the two runs differ by up to a factor of two for Workpiece’s booleans, so this is not a speed claim.

The boolean bench

target/release/boolean-bench, 1917 cases, 23.6 s of wall time on 32 threads: 1902 pass, 12 refused, 3 wrong, 0 crashed.

GroupCasesPass
Hand-made (box, cylinder, sphere, turned, coincident, tangent, nearmiss, chain, random, features)618618
brep-bench’s cases (brep-*, 19 categories)236236
step: parts of public files, halved, drilled, combined280280
step-import: 675 public STEP files675663 (12 refused)
step-conformance (below)108105 (3 wrong)

The 12 refused files are listed with their reasons in the bench’s output: a solid invalid as written (two faces overlap by 4.7e-7), a face that goes several times around its axis (2), files with no solid (2), an edge 0.04 off its surface (2), a loop that does not close on its surface (2), a face with no axis, edges that do not join two faces, and a loop around an axis that never comes by its seam. The boolean bench’s per-category medians are in results.json.

brep-bench’s cases are built by Workpiece’s own port (bench/boolean/src/brepbench.rs) and graded by brep-bench’s rule against the expected values copied from its case files, as of its snapshot of 2026-11-05. Workpiece is not on brep-bench’s published board, and brep-bench has more cases now, so no other kernel’s numbers are put beside these.

step-conformance

Workpiece’s cells, by kind of part, beside the table the benchmark’s maintainers published on 2026-11-22 (their README at commit 3f6d18b, results/RESULTS.md at 61b6a87; one Intel Core i7-12700KF under Windows; the other readers were run by them, not here):

ReaderVersionShop parts (28)Freeform panel (4)Known shape (76)All (108)Scored by
Workpiece (run here 2026-11-25)450425c + changes28176105Workpiece’s port of the rule (self)
ogeom0.11.528376107benchmark maintainers
OpenCascadeopencascade-rs 0.3.0, OCCT 7.8.128176105benchmark maintainers
solidcraftc95c2bef428176105benchmark maintainers
solidcraft through cadmpegc95c2bef4, cadmpeg 0.6.1228176105benchmark maintainers
truck, master88ed0052306891benchmark maintainers
truck, releasedtruck-stepio 0.3.0, truck-meshalgo 0.4.02106081benchmark maintainers
brepkit4.1.492003050benchmark maintainers

The three cells Workpiece does not pass are the freeform panel at 0.0125, 0.05 and 0.1 mm, 0.48 to 0.55 mm off the true surface; the benchmark’s README says its OpenCascade reader is also 0.6 mm off there. Workpiece’s median for a cell is 65 ms on this machine; the benchmark’s own timings are on another machine and are not compared.

Other kernels

Only numbers that their benchmark’s maintainers published, or that were reproduced here, are given. Workpiece did not run any other kernel for this page except springrep (below).

brep-conformance, suite 2.0.1

The maintainers’ official run on 2026-11-23: one bare-metal AWS c7i.metal-24xl (Intel Xeon Platinum 8488C), suite 2.0.1 at commit dc7ac9e, all 3650 cases. The reports are on the suite’s CDN (run 45083601338-1; kentron 45204786615-1; anvil-brep and springrep 45259371420-1; listed in the suite’s reports.json); the numbers below are counted from those files by update_results.py. The leaderboard is at springcraft-ai.github.io/brep-conformance. Cases passed at 1e-7 mm, best first (by the share of the cases run that passed, the all column; ties by the number passed):

KernelVersionLicencebooleans (1253)constructions (448)queries (320)modify (612)fillets (627)chamfers (171)step (163)parts (56)all (3650)
springrep2.1.0MIT1253448320612627171163563650
Workpiece (self-scored, run here 2026-11-26)0.1.0MIT OR Apache-2.01253448320612627171163563650
cadrs0.2.9MIT OR Apache-2.01253448320612627171161563648
kentron0.19.3AGPL-3.0-or-later AND BSD-3-Clause AND MIT1183410316535582171148553400
OpenCascade8.0.1.1.0LGPL-2.1-only WITH OCCT-exception-1.01192279270421418171142402933
next.BREP0.24.0LicenseRef-Autodrop3d99530060344343129140342345
arris0.10.0MIT OR Apache-2.0962223213184328115128292182
cad-kernel0.17.0MIT OR Apache-2.011651945334722000302009
solidcore1.0.1Apache-2.0958267605435900291727
anvil-brep0.2.0MIT OR Apache-2.0811128018411896091346

How to read it: every row but Workpiece’s is the maintainers’ report, whole suite (3650 cases); Workpiece’s row is the run here of the same 3650 cases (the NIST files included), self-scored. springrep 2.1.0 was also reproduced here on the 3617 cases without the NIST files: 3617 of 3617. The maintainers’ registry lists a version for each kernel and the adapter commit their run used; some kernels’ licences are as their registry states and may differ in other releases. The rows say what each kernel passed in the suite’s run, not what it can do outside the suite.

step-conformance

See the table above: its other rows are the maintainers’ own.

Where Workpiece is weak

Taken from the results above and from the code and README.md (what is not built is listed per feature in Ribbon.md):

  • Self-scored. Every Workpiece row is a run by Workpiece’s authors. The brep-conformance suite’s authors have not reviewed Workpiece’s adapter, and the step-conformance maintainers have not scored this version.
  • Functions not answered. The brep-conformance adapter does not answer the functions inertia, betti, section_area and mesh (no case of the suite’s 3650 needed them).
  • STEP import. 12 of 675 public STEP files are refused (listed above); the importer reads solids (including tessellated AP242 solids) and does not read wires, and refuses a band around a B-spline ring’s tube (ops/step/src/lib.rs); 3 of 108 step-conformance cells fail (the freeform panel); on the shop parts of step-conformance Workpiece is compared with itself.
  • Booleans that cannot be done exactly are refused with a reason instead of approximated; the bench counts a refusal as better than a wrong answer, and has 12 refusals, all of STEP files.
  • Speed. On brep-conformance, springrep’s per-category medians are lower than Workpiece’s in modify, fillets and chamfers on the same machine in the same sandbox.
  • Features not built are listed in Ribbon.md (for example guide rails for sweeps, ellipse constraints, sheet-metal reliefs, hems and jogs).
  • Benchmarks are narrow. All three measure geometry kernels on solids; none measures the sketcher, assemblies, drawings or the application.

Reproducing Workpiece’s numbers

You need a Rust toolchain (the workspace’s rust-version is 1.95), Python 3, and bubblewrap (bwrap) for the suite. Every command is run from the repository root.

The boolean bench and step-conformance

cargo build --release -p workpiece-boolean-bench
target/release/boolean-bench fetch            # once: downloads the pinned datasets (about 270 MB)
target/release/boolean-bench | tee boolean.log   # about half a minute on 32 threads; minutes on fewer
# the per-case results are in target/bench-results/boolean.tsv

boolean-bench step-conformance runs only that benchmark’s cells. The run fails if a case that passes in bench/boolean/baseline.tsv no longer does.

brep-conformance

The suite is third-party code, so it is built and run in a sandbox with no network and no access to your home directory; bench/conformance/README.md has the whole setup. In short:

export WORKPIECE_BENCH_DIR=$HOME/.cache/workpiece-bench
# once: clone the suite and the adapter at the pinned commits, fetch their crates, build them in the sandbox
# (bench/conformance/README.md, "Setting the sandbox up from nothing", has the commands: the suite at
# commit dc7ac9ed1e588978767a45306f098f6f512f8bba and springrep's adapter at feaf7ef2b9231f4f22b1992031cd7a1aa414ea30)

bench/conformance/build.sh                       # Workpiece's adapter, outside the sandbox
OUT=workpiece THREADS=14 bench/conformance/run.sh workpiece
python3 -I bench/conformance/summarize.py $WORKPIECE_BENCH_DIR/conformance-sandbox/out/workpiece.json

The suite’s --threads and the machine change the times, not the passes. springrep was run with bench/conformance/run.sh springrep (the adapter’s repository at commit feaf7ef, which depends on springrep = "=2.1.0" from crates.io).

Regenerating results.json

python3 -I docs/benchmarks/update_results.py \
  --conformance   $WORKPIECE_BENCH_DIR/conformance-sandbox/out/workpiece.json \
  --boolean-log   boolean.log --boolean-tsv target/bench-results/boolean.tsv \
  --machine "describe your machine" --commit "$(git rev-parse --short HEAD)"

Add --reproduced FILE for springrep’s results file, and --published-conformance FILE... for the maintainers’ reports (download them from the CDN paths in the suite’s reports.json: https://cdn.springcraft.ai/brep-conformance/reports/<run>/<file>). The script keeps the rows it was not given inputs for.

results.json and CI

results.json has, per benchmark, the rows above: kernel, version, licence, link, who scored it, the date, pass and total overall and by category, and times where there are some. A page can draw a chart from it directly (the homepage section links to this page’s Summary). .github/workflows/bench.yml runs Workpiece’s own rows (the boolean bench with step-conformance, and brep-conformance with the suite pinned at dc7ac9e) on manual dispatch and weekly, and uploads a regenerated results.json as an artifact. It does not run any other kernel. The runner is a shared virtual machine; its times are not comparable with the ones here.

Method notes

  • A row’s “published” origin means the numbers come from files or tables the benchmark’s maintainers published, copied or counted without change. “Reproduced” means built and run here from the pinned public version in the sandbox. “Run here” is Workpiece.
  • Other kernels are named with the version and licence their benchmark states, and linked. No row is ranked or described beyond its numbers.
  • Third-party code (the suite, springrep and its adapter) was built and run only inside bwrap with no network, with the crates fetched beforehand and not built outside the sandbox.
  • A kernel missing from a table was not run by its benchmark’s maintainers or was not reproducible here. Of the kernels Workpiece’s authors have run before in other benchmarks (brep-bench cases, STEP rounds) no result is given on this page, because the cases have changed since, or the run cannot be repeated with a command given here.

The two suites in detail

  • Booleans: bench/boolean, the cases, the datasets and the current results.
  • brep-conformance: bench/conformance, Workpiece’s adapter for the third-party suite and the sandbox that runs it.

The boolean benchmark suite

The thorough tests of lib/boolean and of the STEP importer: 1917 cases that take about half a minute on 32 threads (minutes on a laptop). They are not part of cargo test; run them when the boolean code or the STEP importer changes. How the results compare with other projects’ is in docs/benchmarks.

Method

Each case builds two solids (or one, or a STEP file), applies the operation, and is graded as in brep-bench:

  • pass: a valid, closed solid (written to a topology and validated there) with the expected volume, and area where it is known, to a relative 1e-6. Volume and area are measured from the surfaces and loops themselves (workpiece_boolean::measure), not from a mesh.
  • refused: the operation declined, with a reason.
  • wrong: anything else. Refused ranks above wrong.
  • crashed: a panic.

Cases without a closed form are checked by what holds of any boolean: |A ∪ B| = |A| + |B| − |A ∩ B|, |A − B| = |A| − |A ∩ B|, |B − A| = |B| − |A ∩ B|.

The run exits with an error if a case that passes in baseline.tsv no longer does, or if a case is wrong or crashes that was not before. The per-case results of the last run are in target/bench-results/boolean.tsv.

Running it

cargo build --release -p workpiece-boolean-bench
target/release/boolean-bench fetch                # once: download the datasets (about 270 MB)
target/release/boolean-bench                      # run every case
target/release/boolean-bench sphere tangent       # some categories, or case names
target/release/boolean-bench --bless              # accept the results as the baseline

cargo run --release -p workpiece-boolean-bench -- <arguments> does the same.

Cases

CategoryWhat
box, cylinder, sphere, turnedPairs with volumes in closed form: crossing, nested, apart, through and blind holes, cones and rings, turned every way
coincidentFaces in one plane, on one cylinder or sphere; whole solids the same
tangentSolids that touch along a line or at a point
nearmissFaces brought within ¼ to 10⁴ tolerances of each other
chainMany booleans on one body
randomRandom pairs of boxes, cylinders and balls: the four booleans must agree with each other, and the common volume with a count of random points
featuresCases of our own (src/features.rs), each with an answer in closed form and graded to the same relative 1e-6: standard parts by their sizes in the standards, where faces cross, surfaces trimmed by a plane and rounded along an edge, a closed mesh read as a solid, a STEP file written in inches and read back, a curve through points and a helix’s length. features_occt.py runs the same cases with Open CASCADE (cadquery-ocp) for comparison
brep-*The cases of brep-bench, built by src/brepbench.rs and graded by its rule (volume and area to a relative 1e-6): brep-boolean, brep-tangent, brep-fillet, brep-chamfer, brep-geometry, brep-parts, brep-nurbs (one case more than brep-bench’s), brep-spline, brep-singular, brep-primitives, brep-sweep, brep-loft, brep-swept, brep-feature, brep-edit, brep-offset, brep-shell, brep-thicken, brep-draft. The expected values are in src/brepbench_expected.rs. boolean-bench brep-run CASE OUT.stl is a runner for brep-bench’s own harness
step-conformanceThe 27 parts of step-conformance, each read and meshed at its four tolerances (108 cells), scored by src/conformance.rs, a port of its rule
step-import675 public STEP files: each has to import as solids that are valid and closed
stepThe parts of the first sets, each halved, sliced, drilled and combined with itself, the results checked against each other

rounds_occt.py rounds single edges of the NIST and FreeCAD parts with Open CASCADE for comparison with boolean-bench fillet-corpus; it needs cadquery-ocp.

Datasets

datasets.tsv pins every file by address and SHA-256; fetch puts them in target/bench-data. They are not part of the repository.

SetSourceTerms
nistNIST MBE PMI Validation and Conformance Testing: the CTC, FTC and STC parts, exported from several CAD systemsNo restrictions; NIST asks to be acknowledged
kicadKiCad 3D model library, a sample of packages, at a pinned commitCC-BY-SA 4.0 with an exception
freecadFreeCAD library, a sample of parts, at a pinned commitCC-BY 3.0
step-conformanceThe parts and truth files of step-conformanceCC0
kicad-more, freecad-more605 more files of the same two libraries, spread over all their folders; imported onlyas above

STEP conformance

step-conformance grades STEP importers: each part is read and meshed at 0.0125, 0.05, 0.1 and 0.5 mm, and a cell passes if the mesh has every face of the file, reaches no further than the file’s geometry, and is within four tolerances of the true surface, both ways, in under 60 seconds. src/conformance.rs applies that rule with what is known here:

  • every part has to import as valid, closed solids with as many faces as the file has, mesh into triangles that close up, and take under 60 seconds;
  • a part of known shape (its .truth.json) has every vertex and triangle middle within four tolerances of the true surface, every one of some 200,000 points of the true surface within four tolerances of the mesh, and, stricter than the benchmark, the solid’s own volume equal to the true one to a millionth;
  • the freeform panel is held to the same distances both ways, against its true walls, floor and flat ends;
  • the shop parts, whose truth in the benchmark is OpenCascade’s own fine mesh, are held to the first rule and to the size the benchmark gives for them; Workpiece’s own fine mesh stands in for the reference reader, so those 28 cells are a weaker check than the benchmark’s.

The benchmark’s own scorer takes a reader as a program: boolean-bench step-read OUT TOLERANCE FILE writes what its README asks of one.

Current results

2026-11-25, 32 threads, commit 450425c with uncommitted changes: 1917 cases in 23.6 s, 1902 pass, 12 refused, 3 wrong, 0 crashed. By category:

CategoryCasesPassMedian per case
box, cylinder, sphere, turned2892891.1 to 10 ms
coincident, tangent, nearmiss, chain, random, features3293291 to 35 ms
brep-* (19 categories)2362360.4 to 127 ms
step280280185 ms
step-conformance10810565 ms
step-import67566312 ms
  • The three wrong are the freeform panel of step-conformance at 0.0125, 0.05 and 0.1 mm: 0.48 to 0.55 mm off its true surface.
  • The 12 refused are STEP files, each with its reason in the run’s output: a solid invalid as written (two faces overlap by 4.7e-7), a face that goes several times around its axis (2), no solid in the file (2), an edge 0.04 off its surface (2), a loop that does not close on its surface (2), a face with no axis, edges that do not join two faces, a loop around an axis that never comes by its seam.
  • Every boolean of every file that imports passes.

A boolean that cannot be done exactly is refused, not approximated. Where four faces of a result come to one edge, each two that bound the same material get a copy of the edge of their own, and the result is a valid solid. A result is tidied before it is handed back: faces side by side in one surface become one face, and edges end to end on one curve one edge. The boolean code has one path for every shape: lib/boolean holds only NURBS curves and surfaces and finds where they meet by Bézier clipping, with no case for lines, planes, cylinders or any other kind.

The STEP importer reads solids, at every place an assembly uses them (tessellated AP242 solids too), in any length unit; it does not read wires. IGES is read and written (workpiece_ops_step::{import_iges, export_iges}) as trimmed NURBS surfaces, with a round trip test (bodies_written_as_iges_read_back_as_they_were).

Workpiece on brep-conformance

brep-conformance is a kernel-neutral suite published with the kernel springrep. It drives a kernel through an adapter (one JSON request per line on stdin, one reply per line on stdout) and judges every case at 1e-7 mm, and again at 1e-6, 1e-5 and 1e-3 mm. A kernel’s headline is the share of all cases it passes at 1e-7 mm; cases it does not support count against it.

This folder holds Workpiece’s adapter (src/, the binary workpiece-adapter) and the scripts that build and run the suite in a sandbox. How the results compare with other kernels’ is in docs/benchmarks.

Method

The suite’s rule is that an adapter answers each function with the kernel’s one call for it and adds nothing: no composing of functions, no retries, no repair, no thresholds. A function without such a call is left out of supports, and its cases count as unsupported. The suite’s maintainers run kernels they have registered, with adapters they review; Workpiece is not registered, so a run here is self-scored and its adapter has not been reviewed by them.

What the adapter calls:

FunctionWorkpiece’s call
box, cylinder, sphere, torus, cone, slabThe operations AddBox, AddCylinder, AddSphere, AddTorus, AddCone; slab is built in src/main.rs
extrude, revolveA Sketch of the profile, then Extrude or Revolve
screwA Sketch, then SweptLoft as a coil
loft, loft_through, sweep, sweep_pathworkpiece_shape::swept::through_sections, along_path
union, intersection, difference, union_all, difference_allworkpiece_boolean::combine, combine_all
fillet, fillet_variable, fillet_conic, fillet_g2, fillet_setback(+_g2), fillet_radii, fillet_faces, full_round, chamfer, chamfer_two, chamfer_distancesworkpiece_shape::blend_chains, blend_solid and the blend library’s variants; corners closed
offset, shell, offset_faces, move_faces, thicken, draftthick::thickened, faces_offset, faces_moved, thicken, drafted
delete_facesworkpiece_ops_faces::faces_deleted
split, transform, affineworkpiece_shape::halves, Solid::mapped, Solid::sheared
write_step, read_step, sewworkpiece_ops_step::export, import, import_sheets with workpiece_boolean::stitched
volume, area, centroidworkpiece_boolean::measure
classify, normal, closest, curvature, bounding_box, raycastPlacer (workpiece_boolean::place)
section, project, display, interference, distanceplane_section and workpiece_shape::section, project, display, interference, distance
checkworkpiece_boolean::write into a fresh Topo, then Topo::validate

Not offered: inertia, betti, section_area, mesh.

Choices the adapter makes, within the rule:

  • hello declares a tolerance of 1e-7 mm and no configuration. The kernel’s tolerances are relative to a solid’s size; nothing is set.
  • Every kernel error is answered as failed, because Workpiece’s errors do not say whether the input or the kernel is at fault. Only the adapter’s own “this point names no edge/face” is invalid.
  • A point names an edge through geometry::on_curve at 1e-6 mm, and a face through lies_on at 1e-6 mm. A seam (an edge both of whose uses are by one face) is not counted as an edge, as the suite’s own definition of display lists seams apart from edges. A point that still lies on two edges or two faces is answered unsupported, as the rule says.
  • read_step joins the solids of a file with combine(Union), as the contract asks.
  • Profiles. Lines, arcs and conics are drawn as the sketch’s lines, arcs and rational quadratic splines; a periodic spline is given as the same curve with clamped knots (profile.rs). A gn blend section is not a NURBS: unsupported.
  • loft, loft_through, sweep take one outline. A profile with a hole is unsupported there.
  • move_faces with a rotation is unsupported: faces_moved only shifts.

Running it

Files:

PathWhat
build.shBuilds the adapter into target/conformance (--head: against the last commit)
sandbox.shThe bwrap line: no network, /home hidden, one folder writable
run.shRuns the suite on workpiece or springrep inside the sandbox
summarize.pyThe tables, and the list of failing cases, from results files

Where things live: WORKPIECE_BENCH_DIR (default ~/.cache/workpiece-bench) holds the clones (brep-conformance, brep-conformance-springrep) and the sandbox conformance-sandbox/ with the suite, springrep’s adapter, the fetched crates and the results in out/. Nothing in it is part of the repository.

# 1. Workpiece's adapter (our code, built outside the sandbox, into target/conformance)
bench/conformance/build.sh

# 2. the whole suite, in the sandbox; about a minute with 14 workers
OUT=workpiece THREADS=14 bench/conformance/run.sh workpiece
#    one area: a test path, a directory, or a family's name
OUT=try bench/conformance/run.sh workpiece --family fillets/ --timeout 60

# 3. the tables and the failures
python3 -I bench/conformance/summarize.py $WORKPIECE_BENCH_DIR/conformance-sandbox/out/workpiece.json
python3 -I bench/conformance/summarize.py --failures $WORKPIECE_BENCH_DIR/conformance-sandbox/out/workpiece.json

# springrep (the maintainers' adapter, for comparison on this machine)
bench/conformance/run.sh springrep

SUITE and SPRINGREP_ADAPTER name the sandbox’s folders for the suite and springrep’s adapter (defaults suite and springrep-adapter), to keep several versions side by side. The suite’s HTML report is out/<name>.html; it holds its own data and asks the network for nothing.

run.sh is this line, with the paths filled in:

bwrap --unshare-all --die-with-parent \
  --ro-bind /usr /usr --symlink usr/lib /lib --symlink usr/lib64 /lib64 --symlink usr/bin /bin \
  --ro-bind /etc/alternatives /etc/alternatives --ro-bind /etc/ld.so.cache /etc/ld.so.cache \
  --proc /proc --dev /dev --tmpfs /tmp --tmpfs /home --tmpfs /run \
  --ro-bind ~/.rustup/toolchains/1.99.1-x86_64-unknown-linux-gnu /toolchain \
  --bind $WORKPIECE_BENCH_DIR/conformance-sandbox /work \
  --ro-bind $WORKPIECE_BENCH_DIR/conformance-sandbox/cargo-home /work/cargo-home \
  --ro-bind target/conformance/release /workpiece-bin \
  --clearenv --setenv PATH /toolchain/bin:/usr/bin --setenv HOME /tmp \
  --setenv CARGO_HOME /work/cargo-home --setenv CARGO_NET_OFFLINE true --setenv LANG C.UTF-8 \
  --chdir /work \
  sh -c 'cd /work/out && exec /work/suite/target/release/brep-conformance \
    --adapter /workpiece-bin/workpiece-adapter --threads 14 --out workpiece.json --html workpiece.html > workpiece.log 2>&1'

The suite spawns the adapter, so Workpiece’s adapter runs in the same sandbox, its binary mounted read-only. sandbox.sh expects the Rust toolchain 1.99.1 in ~/.rustup/toolchains; change TC in it for another.

Setting the sandbox up from nothing

The suite at the commit of its official 2.0.1 run, and springrep’s adapter at the commit the suite’s registry pinned for that run:

export WORKPIECE_BENCH_DIR=$HOME/.cache/workpiece-bench
mkdir -p $WORKPIECE_BENCH_DIR && cd $WORKPIECE_BENCH_DIR
git clone https://github.com/springcraft-ai/brep-conformance
git -C brep-conformance checkout dc7ac9ed1e588978767a45306f098f6f512f8bba
git clone https://github.com/springcraft-ai/brep-conformance-springrep
git -C brep-conformance-springrep checkout feaf7ef2b9231f4f22b1992031cd7a1aa414ea30
SB=$PWD/conformance-sandbox; mkdir -p $SB/out $SB/cargo-home
rsync -a --exclude .git brep-conformance/ $SB/suite/
rsync -a --exclude .git brep-conformance-springrep/ $SB/springrep-adapter/
rm $SB/suite/rust-toolchain.toml $SB/springrep-adapter/rust-toolchain.toml   # they pin 1.99.0; use the installed 1.99.1
# in $SB/springrep-adapter/Cargo.toml: delete the [dev-dependencies] section (a git dependency
# only its tests use) and add an empty [workspace] table (so that it builds on its own)
(cd $SB/springrep-adapter && CARGO_HOME=$SB/cargo-home RUSTUP_TOOLCHAIN=1.99.1 cargo fetch)
(cd $SB/suite && CARGO_HOME=$SB/cargo-home RUSTUP_TOOLCHAIN=1.99.1 cargo fetch --locked)
cd - && bench/conformance/sandbox.sh -- sh -c 'cd /work/suite && cargo build --release --offline --locked -p brep-conformance'
bench/conformance/sandbox.sh -- sh -c 'cd /work/springrep-adapter && cargo build --release --offline'

cargo fetch only downloads. After the first build inside the sandbox, never run cargo outside it with CARGO_HOME=$SB/cargo-home; the sandbox mounts that folder read-only for the same reason.

springrep is run from springrep 2.1.0 on crates.io, which the adapter’s manifest asks for (springrep = "=2.1.0"), not from a clone of its repository.

The suite also has cases that read NIST’s STEP files (step/read-nist, 33 of its 3650 cases), run only with --nist. Their files come from the suite’s own nist/fetch.py, run outside the sandbox (it needs the network) with an isolated Python; it downloads NIST’s archive (from the suite’s CDN or nist.gov), checks it against the SHA-256 written in the script before unpacking, and writes only the .stp files that nist/validation.json lists, into the suite’s nist/ folder. Then the whole suite runs in the sandbox, which sees that folder as /work/suite/nist:

python3 -I $SB/suite/nist/fetch.py
bench/conformance/run.sh workpiece --nist /work/suite/nist

Audit of the third-party code

Done on 2026-11-22 against the suite 2.0.0 and springrep 2.0.0 clones, the adapter’s repository, and the crates.io copies that were compiled; not repeated for the 2.0.1 / 2.1.0 versions run now, apart from building them in the same sandbox. Verdict then: nothing malicious found. Everything of theirs was still built and run only inside the sandbox.

  • Build scripts. springrep has one build.rs: it reads the .rs files under src, hashes them (FNV-1a) and sets the environment variable SPRINGREP_SOURCE for the compiler. It writes nothing and starts nothing. The suite’s three crates and the adapter have none.
  • Network. No socket, HTTP client or URL fetch in any Rust source. The only URLs are a CDN prefix written into reports and the registry’s GitHub addresses.
  • Processes. brep-protocol starts the adapter it is given and kills its process group on a timeout (two unsafe lines: libc::kill). suite/src/registry.rs runs git clone and sh -c <build step> from kernels.json, but only for --kernel NAME; the runs here use --adapter and never reach it. Do not use --kernel outside the sandbox: it downloads and builds other people’s code.
  • Files. The suite writes its --out, --html, --glb and --step outputs where it is told; springrep’s library writes no file.
  • Embedded files. A minified three.js r128 goes into the HTML report; it runs only in a browser that opens the report.
  • Scripts not run. bench/*.sh (their benchmark machine’s setup), site/, the GitHub workflows.
  • nist/fetch.py (71 lines, read on 2026-11-26) is the one script of theirs run outside the sandbox: standard library only; it fetches one zip from two fixed addresses, refuses it unless its SHA-256 matches, and writes only the listed .stp files beside itself.

Current results

2026-11-26, suite 2.0.1 at commit dc7ac9e, the whole suite with --nist (all 3650 cases, seed 1, 120 s per call, 14 workers on a 32-thread AMD Ryzen 9 7950X shared with other jobs). All 3650 cases pass at 1e-7 mm: booleans 1253, constructions 448, queries 320, modify 612, fillets 627, chamfers 171, step 163 (the 33 NIST cases included), parts 56; none unsupported, refused, timed out, failed or crashed. The run took 53 s. Self-scored: the suite’s maintainers have not reviewed this adapter.

The medians per category are from the two earlier runs of 2026-11-25 without the NIST cases (3617 cases, all passed, 55 s and 68 s; Workpiece at 450425c with uncommitted changes):

categorycasesat 1e-7 mmmedian ms (two runs)
booleans1253125347.9 / 86.9
constructions448448131.2 / 133.6
queries3203200.5 / 0.7
modify6126125.9 / 6.2
fillets6276274.3 / 4.5
chamfers1711711.8 / 1.9
step (without NIST)1301300.4 / 0.5
parts565614.4 / 18.2
all3617361722.1 / 28.1

springrep 2.1.0 passes all 3617 as well on this machine, in those runs (57 s and 71 s for the whole run). The times are from a machine with other work running, and differ between runs, so they are not a measure of speed.