Decad is Deconstructed CAD https://lestrrat-3d.github.io
  • Go 99.6%
  • Lean 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 05:02:11 +09:00
.github rebalance contention-heavy shards (#3563) 2026-12-03 05:02:11 +09:00
_gallery update sketch and r3 dependencies (#3553) 2026-12-02 20:29:30 +09:00
_lookup add layout lookup index (#3529) 2026-12-02 09:12:14 +09:00
_proofs speed up small float steps (#3552) 2026-12-02 19:54:29 +09:00
_shardgen rebalance race shards after RunSteps tests (#3468) 2026-11-27 00:49:33 +09:00
agent-docs charge the tilt of cylinder end corners per root (#3561) 2026-12-03 01:06:11 +09:00
apitest move public-API tests into apitest (#634) 2026-10-06 20:26:44 +09:00
bodywire retain STEP assembly face identity (#3528) 2026-12-02 08:32:22 +09:00
docs add mesh surface boundary queries (#3541) 2026-12-02 17:02:45 +09:00
dynamics merge dynamics design docs into multibody doc (#3330) 2026-11-18 22:16:16 +09:00
export add mesh mass, clearance and step identity (#3505) 2026-12-01 12:28:47 +09:00
internal charge the tilt of cylinder end corners per root (#3561) 2026-12-03 01:06:11 +09:00
linkage fix loop reach guard and refused hull ranges (#3082) 2026-11-03 20:49:57 +09:00
parts review five large design docs against code (#3343) 2026-11-19 10:03:59 +09:00
report add verify option to skip named pairs (#3412) 2026-11-25 01:19:42 +09:00
scripts check nested Go modules instead of syncing them (#3080) 2026-11-03 19:18:48 +09:00
.gitattributes add initial scaffolding 2026-07-12 20:24:36 +09:00
.gitignore ignore private overlay packages and fix README links (#3498) 2026-11-30 18:26:31 +09:00
.golangci.yml convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
AGENTS.md add layout lookup index (#3529) 2026-12-02 09:12:14 +09:00
arrange.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
arrange_angle.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
body_digest.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
boolean.go preserve matching loft cut continuations (#3471) 2026-11-27 11:43:55 +09:00
boolean_group_blind.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
boolean_group_cache.go extract generic boolean proof helpers (#3013) 2026-11-02 20:23:15 +09:00
boolean_group_history.go move group union source replay internally (#3018) 2026-11-02 23:08:57 +09:00
boolean_group_tessellate.go fix bounded brake clevis retry (#2996) 2026-11-02 10:44:55 +09:00
boolean_many.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
boolean_orthogonal.go consolidate agent-docs design and layout files (#3135) 2026-11-05 20:31:12 +09:00
boolean_regroup.go preserve matching loft cut continuations (#3471) 2026-11-27 11:43:55 +09:00
boss.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
boss_fillet.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
boss_shape.go brace shaped bosses with gusset ribs (#2747) 2026-10-28 01:53:36 +09:00
brep_modify.go merge modify family designs into modify doc (#3333) 2026-11-18 23:04:18 +09:00
brep_modify_partial.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
chain_tolerance.go add a document chain tolerance (#2373) 2026-10-24 05:48:01 +09:00
chamfer.go chamfer partial cap edges of convex prisms (#3510) 2026-12-01 18:12:14 +09:00
chamfer_angle.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
chamfer_wedges.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
circle_affine_replay.go add circle source placement replay (#3000) 2026-11-02 06:26:52 +09:00
circle_placement_replay.go mint transient ids privately in queries (#3437) 2026-11-26 13:49:09 +09:00
circle_primitive_seal.go add circle source placement replay (#3000) 2026-11-02 06:26:52 +09:00
circle_source_replay.go mint transient ids privately in queries (#3437) 2026-11-26 13:49:09 +09:00
CLAUDE.md add layout lookup index (#3529) 2026-12-02 09:12:14 +09:00
coil.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
cone_from_face.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
contact_pair.go mint transient ids privately in queries (#3437) 2026-11-26 13:49:09 +09:00
contact_sweep.go mint transient ids privately in queries (#3437) 2026-11-26 13:49:09 +09:00
container.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
cut_profile.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
doc.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
document.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
draft.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
draft_mesh_prism.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
edge_dihedral.go chord fillets and angle chamfers on rod rims (#2568) 2026-10-27 04:07:45 +09:00
emboss.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
emboss_rim.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
errors.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
extent.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
extrude.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
extrude_tilted_face.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
feature_options.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
fillet.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
fillet_chord.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
gap_tolerance.go add a read-only intersection volume query (#3438) 2026-11-26 15:43:01 +09:00
go.mod update sketch and r3 dependencies (#3553) 2026-12-02 20:29:30 +09:00
go.sum update sketch and r3 dependencies (#3553) 2026-12-02 20:29:30 +09:00
hole.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
hole_faceted_site.go consolidate agent-docs design and layout files (#3135) 2026-11-05 20:31:12 +09:00
infill.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
intersection_volume.go add a read-only intersection volume query (#3438) 2026-11-26 15:43:01 +09:00
lattice.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
LICENSE add initial scaffolding 2026-07-12 20:24:36 +09:00
linkage.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
loft.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
loft_faces.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
loft_point.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
loft_sections.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
mass_properties.go add analytic axial revolve bores (#2928) 2026-10-31 07:14:27 +09:00
measurement.go move report vocabulary into report package (#2311) 2026-10-21 07:55:52 +09:00
mesh_body.go add mesh mass, clearance and step identity (#3505) 2026-12-01 12:28:47 +09:00
mesh_body_mass.go add mesh mass, clearance and step identity (#3505) 2026-12-01 12:28:47 +09:00
mesh_clearance.go add mesh mass, clearance and step identity (#3505) 2026-12-01 12:28:47 +09:00
mesh_import.go read step assemblies and set the chord tolerance (#3503) 2026-12-01 08:52:20 +09:00
mesh_reduce.go add isotropic mesh remeshing (#2796) 2026-10-28 06:54:17 +09:00
mesh_refine.go add edge-splitting refinement of mesh bodies (#2558) 2026-10-27 02:22:41 +09:00
mesh_repair.go fix dangling design doc references (#3324) 2026-11-18 20:26:44 +09:00
mesh_scale.go scale a solid body per axis as a mesh (#2567) 2026-10-27 03:55:38 +09:00
mesh_section.go add exact plane sections of mesh bodies (#3500) 2026-11-30 23:56:37 +09:00
mesh_surface.go add mesh surface boundary queries (#3541) 2026-12-02 17:02:45 +09:00
mirror.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
mirror_join.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
modify_options.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
motion.go merge motion check design into linkage doc (#3331) 2026-11-18 22:36:38 +09:00
motion_verify.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
move_face.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
native_cheek_band.go certify cylindrical side contacts in flange cuts (#3383) 2026-11-21 09:03:49 +09:00
native_cheek_contact_bounds.go certify cylindrical side contacts in flange cuts (#3383) 2026-11-21 09:03:49 +09:00
native_cheek_cut.go certify cylindrical side contacts in flange cuts (#3383) 2026-11-21 09:03:49 +09:00
native_rim_aligned.go chamfer aligned pads on machined flanges (#3379) 2026-11-21 06:30:36 +09:00
native_rim_annulus.go read identity counters through the context (#3440) 2026-11-26 12:00:03 +09:00
native_rim_chamfer.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
native_rim_chart.go chamfer aligned pads on machined flanges (#3379) 2026-11-21 06:30:36 +09:00
native_rim_surface.go keep raw mesh plane bounds on verified fragments (#3389) 2026-11-21 14:17:42 +09:00
offset.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
operation_command.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
operation_diagnostics.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
operation_history.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
operation_kind.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
params.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
patch.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
patch_body.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
path.go sweep: add explicit ArcAround path segments (#2988) 2026-11-01 18:48:40 +09:00
path_pattern.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
pattern.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
planar_face.go tag oblique stacked walls with tilt bounds (#3282) 2026-11-17 17:46:44 +09:00
point_cap_extremes.go rank mesh solid faces by centroid (#2780) 2026-10-28 05:15:38 +09:00
point_containment.go recheck body solidity after point classification (#3020) 2026-11-02 23:10:35 +09:00
point_plane_scale.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
prism_scale.go keep operand cap roles on analytic booleans (#2897) 2026-10-30 21:38:17 +09:00
quarter_turn.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
reader_install.go limit bodywire tessellation and frame reads (#3497) 2026-11-30 17:31:47 +09:00
README.md ignore private overlay packages and fix README links (#3498) 2026-11-30 18:26:31 +09:00
record.go merge boolean family designs into prism doc (#3334) 2026-11-18 23:27:23 +09:00
refine.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
report.go split agent docs from user docs (#2298) 2026-10-21 13:06:36 +09:00
revolve.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
rib.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
rim_extension.go read producer id through private capture (#3445) 2026-11-26 12:20:21 +09:00
rim_extension_history.go Chamfer stopped shoulders at transverse cylindrical supports (#3380) 2026-11-21 06:45:36 +09:00
rim_outer.go read producer id through private capture (#3445) 2026-11-26 12:20:21 +09:00
rim_outer_native.go chamfer shoulders ending at aligned cone heels (#3384) 2026-11-21 07:45:47 +09:00
rim_split.go read retained cylinder slabs in later booleans (#3356) 2026-11-20 16:08:00 +09:00
seam.go split agent docs from user docs (#2298) 2026-10-21 13:06:36 +09:00
section.go feat: support exact line-arc loft through-bores (#2884) 2026-10-30 15:28:59 +09:00
section_orthogonal.go consolidate agent-docs design and layout files (#3135) 2026-11-05 20:31:12 +09:00
section_outline.go add exact plane sections of mesh bodies (#3500) 2026-11-30 23:56:37 +09:00
SECURITY.md wrap long markdown prose (#201) 2026-08-30 07:50:16 +09:00
selection_error.go move PatchEdges chain gates into patchchain (#2291) 2026-10-20 19:39:11 +09:00
selector.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
sheet_metal.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
shell.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
shell_orthogonal.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
solid_from_mesh.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
stack_brep_scale.go scale partial solid revolves (#2586) 2026-10-27 07:11:42 +09:00
step_assembly.go read step assemblies and set the chord tolerance (#3503) 2026-12-01 08:52:20 +09:00
step_closed_surface.go export translated closed surfaces analytically (#2868) 2026-10-30 06:15:45 +09:00
steps.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
stitch.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
stops.go decide prism g5 spans on denoted levels (#2646) 2026-10-27 13:53:14 +09:00
stretch.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
subd.go subdivide polygon cages into smooth meshes (#2618) 2026-10-27 09:45:24 +09:00
surface.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
surface_trim.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
sweep.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
swept_box.go mint transient ids privately in queries (#3437) 2026-11-26 13:49:09 +09:00
tessellate.go add STEP export for sheet geometry (#3495) 2026-11-30 16:41:44 +09:00
tessellate_verification.go split agent docs from user docs (#2298) 2026-10-21 13:06:36 +09:00
text.go set text along a circular arc (#2573) 2026-10-27 04:57:24 +09:00
thicken.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
thread.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
thread_table.go read ISO 228 pipe thread sizes (#2751) 2026-10-28 02:13:23 +09:00
tool_combine.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
topology.go add Body.Digest and Document.PairDigest (#3443) 2026-11-26 16:44:36 +09:00
topology_handles.go merge tiny root files into their owners (#3132) 2026-11-05 19:41:19 +09:00
union_refined.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
unstitch.go convert every operation to a command (#3433) 2026-11-26 16:10:53 +09:00
verify.go add RunSteps for concurrent build steps (#3465) 2026-11-26 23:03:19 +09:00
verify_result.go move report vocabulary into report package (#2311) 2026-10-21 07:55:52 +09:00

decad

DeepWiki

DECAD letters assemble on a navy plate, a light sweeps across them, the logo holds, and the letters lift away

A headless CAD engine for Go. You build 3D parts in code, then check them: whether each body is a closed, valid solid, what its volume is, whether bodies interfere, and whether any wall is thinner than a minimum you state.

Work in progress. The API and supported capabilities may change.

decad is the 3D modeling layer above the sketch 2D constraint engine and the r3 coordinate-math layer. It needs no CAD application, no GUI and no network.

What decad does

In decad you describe a part the way you would in a CAD application, but as a Go program. You draw a 2D sketch and give it dimensions, then apply features to it one after another: extrude it, cut a hole, round an edge, join it to another body. Running the program builds the part. Change a dimension and run it again, and decad rebuilds the whole part with the new value, the same way every time.

What sets decad apart from a program that only produces a shape is that it can tell you whether the shape is right. Document.Verify checks that each body is a closed, valid solid, that no two bodies overlap, and that no wall is thinner than the minimum you set. Volumes, areas and centroids come with a stated error bound, so you know how far to trust the number. A check that decad cannot settle is reported as undecided, never silently passed, and Report.Passed is true only when every check was proven.

decad also checks parts that move. VerifyLinkage follows a chain of joints, including closed loops such as a four-bar linkage, and proves that no two parts collide anywhere in a stretch of the motion, not only at the poses it sampled. The dynamics package drops bodies under gravity and simulates impact and friction (see Motion and collisions). When you need the result elsewhere, decad writes STEP, IGES, STL, OBJ, 3MF, glTF, DXF, PNG and G-code, and reads STL, OBJ, 3MF, STEP and IGES files.

Quick start

go get github.com/lestrrat-3d/decad
// A solved 2D profile: a 100 x 60 plate on the XY plane.
w := sketch.NewWorld()
s, _ := w.CreateSketch(w.XY())
rect := s.CreateRectangle(0, 0, 100, 60)
s.Fix(rect.A)
s.Solve(ctx)

// Extrude it 10 mm, then verify the document.
doc := decad.New()
body, _ := decad.Extrude(doc, s, s.Profiles()[0],
	decad.Distance{D: units.Millimeters(10), Dir: decad.Along}).Do(ctx)
report, _ := doc.Verify(ctx)
vol, _ := body.Volume()

fmt.Println(vol.Value, vol.Exactness) // 60000 mm^3 Exact
fmt.Println(report.Status, report.Passed()) // Sound true

The snippet drops error handling for length. The checked version is example_quickstart_test.go, and examples/ holds runnable examples by feature, each with output that go test checks. Both live in the private decad-test repository and are overlaid onto this checkout in CI.

What you can do

Task What decad offers
Build Extrude, Revolve, Sweep, Loft and Coil, from sketch profiles that may hold fit splines, with a surface-result option that leaves a sheet body. SheetMetal builds a bent strip and reports its flat length.
Modify Fillet, Chamfer, Shell, Draft, Hole, Thread, Boss, WebPath ribs, Emboss, Thicken and Offset.
Combine Union, Cut, Intersect and Split, plus Copy, Mirror, linear, circular and path patterns, and Arrange, which lays bodies side by side on a flat bed.
Surfaces Patch, Stitch, Unstitch, Trim and Extend on sheet bodies.
Parametrize Feature values read by name or expression from a sketch parameter table. Edit the table and run the program again to rebuild. Document.Bindings lists every value read.
Read Volume, area, centroid, bounds, mass properties, topology, surface and curve geometry, cross-sections, point location and distance, and tessellation with an error bound.
Verify Watertightness and solid validity, interference, clearances, minimum wall thickness, mold undercuts and concave radii, each with a typed diagnostic when a check fails.
Move VerifyMotion for one joint path, VerifyLinkage for joint chains and closed loops, VerifyJointBox for a box of joint values, ContactPair and SweepPair for contact, and the dynamics package for rigid-body timelines.
Assemble The parts package names parts and joints, draws an exploded view and a connection diagram, checks declared joints against the geometry, and writes a bill of materials.
Import and export STL, OBJ and 3MF meshes, STEP solids with plane, cylinder, cone and sphere-cap faces, and planar-faced IGES solids read in as mesh bodies. STEP, IGES, STL, OBJ, 3MF, glTF, DXF, PNG and G-code are written out.

Why this exists

A designer who wants a parametric part works in a CAD application. They draw sketches, give them dimensions, and add features such as extrusions and cuts. When a dimension changes, the application rebuilds the part from those steps.

Coding agents can generate 3D shapes, and some are good enough for a one-off render or print. But if you ask for a bevel gear built to given dimensions, a shape that looks like a gear is only the start. Its teeth have to mesh with its mate. A fresh request to the agent may also produce different geometry, which makes a dimensioned part hard to reproduce.

With decad, a Go program builds and checks the model. With the program and inputs held fixed, the same model can be rebuilt without a fresh request to the agent. The program can measure volume and centroid, check whether bodies interfere or have enough clearance, and ask whether a wall is too thin for a cutting tool. An agent can change a dimension or feature, run the program again, and read the new verification report.

decad suits trying a design before committing to it. An agent can model a part here, prove it sound, and only then write the add-in that builds it in Autodesk Fusion or another CAD application, so a wrong dimension shows up in a test run. Decad does not try to match the speed of a CAD application, and the agent still checks the part in that application, because it may interpret the steps differently.

Each animation shows intermediate decad bodies rendered from the triangle meshes decad tessellates.

An L-shaped profile rises into an angle bracket
Extrude sweeps a solved 2D profile straight into a solid.
A circular profile turns around an axis into a ring
Revolve spins a profile about an axis, so a curved generator gives a curved solid.
One square section rises, turns, extends, and turns again
Sweep carries one profile along a path with two rounded bends and a straight run.
A transition duct grows between two offset rectangles
Loft rules a wall between two profiles on different planes.
Two curved spline edges form a leaf-shaped section before it rises into a solid
Free-form profiles shape a section with fit splines; Extrude carries those curves into the solid walls.
A plate's four upright edges gradually round over
Fillet rounds selected edges into tangent arcs.
A plate's four upright edges become flat bevels
Chamfer cuts selected edges back to a straight bevel.
A plate's top rim gains a bevel
Cap-loop chamfer bevels a whole rim, the lead-in a bore or a lid needs.
A shallow cavity widens into an open tray
Shell hollows a solid into a wall of one thickness.
Three fixed cylinders cut a central bore and two bolt holes into a box
Union, Cut and Intersect combine two bodies explicitly, never folded into a feature.
A pin standing inside a larger bore with clearance all around
Verify reports whether bodies interfere and measures their gap when clearance is requested.
A curved open dish grows as its profile revolves
Surface result keeps a feature's swept walls and omits the faces that exist only to close the solid, leaving a sheet body.
A helical V-groove opens through one end of a cylinder, leaving a short plain collar at the other
Coil and Cut sweep a V-groove around a cylinder and cut it through one end. The result has faceted faces. Its solid validity is proven, but Verify reports Suspect because area, volume and centroid bounds exceed the default tolerances. This example does not specify a standard thread or a mating fit.

Regenerate the gallery GIFs with cd _gallery && go run . features (requires ffmpeg). The still images can be regenerated with go run .; use go run . -only thread for the thread image. From _gallery, regenerate the animated hero with go run . hero > hero-assemble.sh && sh hero-assemble.sh. Its letters assemble, a light crosses them, the finished logo holds for ten seconds, and the letters lift away before the loop repeats.

The landing-page clip animates several gallery parts, a curved duct, and the wordmark. Render it with cd _gallery && go run . clip > assemble.sh && sh assemble.sh: the program writes each shot's PNG frames under _gallery/out/ and prints the two ffmpeg commands, which the script runs to write out/decad-landing.mp4 and out/decad-landing.gif.

Motion and collisions

decad also checks parts that move. Document.VerifyMotion moves bodies along one revolute, prismatic or Between path. Document.VerifyLinkage drives a chain of joints, including a closed loop such as a four-bar or a slider-crank. Document.VerifyJointBox checks every combination of joint values in a box. Each check splits the motion into intervals, or the box into cells, and reports each one as clear, colliding, or undecided. For a clear interval, decad proves that no two bodies overlap at any point in it, not only at sampled poses, and reports a lower bound on the gap. A colliding interval has a proven, measured overlap at one of its ends. An undecided interval makes the report Suspect, and decad does not count it as clear.

The dynamics package simulates rigid bodies under gravity, impact and friction, for the shape and motion paths the collision support guide lists. The box collision example (examples/dynamics_box_collision_example_test.go) runs an impact and reports the rebound. A dynamics.Timeline advances a scene one fixed step at a time. A step that its proofs cannot settle returns Undecided with a typed reason, and the timeline stops there. Every frame below is a pose the check or the timeline computed. The two linkage clips drive each mechanism out to the last pose the check proves clear, just short of its first proven collision, and back. The link and the stop it would hit flash coral while the clip pauses there.

A two-link arm pinned to a post on a base plate folds up to a stop block, the forearm and the block flash coral, and the arm folds back
VerifyLinkage proves the folding arm clear up to s = 91/256, with the forearm all but on the stop: the exact contact is at s = asin(17/32)/90° ≈ 0.3566 and the first proven collision at 92/256. The clip drives to 91/256 and back. At every pose the check evaluates, each pin sits on its bore's centre and measures 0.5 mm clear of it.
A crank drives a pinned four-bar linkage until the follower reaches a stop block, the follower and the block flash coral, and the crank turns back
Closed loops are checked too: VerifyLinkage proves the crank-rocker clear up to s = 118/256 (crank angle 165.94°), just before the follower's flank reaches the stop at a crank angle of 167.62°; its first proven collision is at 120/256. The clip drives to 118/256 and back. All four pins sit on their bores' centres and measure 0.5 mm clear of them at every pose the check evaluates.
Spinning boxes, a hexagonal prism, a wedge and a tetrahedron drop into a tray and settle
Tumble runs all 768 steps of its 3 s timeline, and every body ends at rest on a face, with at least three vertices within 10 µm of the tray floor.
Five modeled parts drop into a tray and settle while a cylinder rolls across the floor
Parts bin drops a shelled cup, a chamfered block, a loft, a swept hexagon and a revolved bottle to rest, while a cylinder rolls 60 mm without slipping.

Regenerate these GIFs with cd _gallery && go run . motion (requires ffmpeg). The same scenes render as full-size PNG frames under _gallery/out/ with go run . linkage, go run . linkage -scene rocker, and go run . dynamics -scene tumble or -scene parts-bin. A third dynamics scene, -scene stack-and-drop, drops spheres and a cylinder beside a resting box pyramid.

Run Refresh gallery images from the GitHub Actions tab to regenerate stills, features, hero, motion, or all. The optional only input passes comma-separated image names to the selected renderer. Leave it blank for all images in that group. When images change, the workflow pushes a new branch and links to a page where you can open a pull request.

Assemblies and export

The parts package names the placed bodies of one document and the joints between them. Set.Explode pulls each part away along its joint axis and returns the offsets, label anchors and leader lines for an exploded view. parts.WithDerivedExplode works out the removal order from the tessellated parts. Set.Check compares each declared joint with the faces of the parts it joins, Set.BOM returns the bill of materials, and Set.Graph writes the connection diagram as a Mermaid flowchart. See examples/parts_summary_example_test.go.

The export package writes a body or a whole assembly to STEP, IGES, STL, OBJ, 3MF, glTF, DXF, PNG or G-code. export.STEPItems and export.ThreeMFItems write several bodies as named, placed parts of one file.

Layering

decad    3D bodies, features, verification   (this module)
         subpackages: export, dynamics, parts
  |
sketch   parametric 2D constraint solving    github.com/lestrrat-3d/sketch
  |
r3       vectors, frames, rigid transforms   github.com/lestrrat-3d/r3
  |
units    typed quantities (Value, Kind)      github.com/lestrrat-3d/units

decad builds solids and sheet bodies, records their topology, applies features and booleans, and runs the verification checks (solid validity, interference, clearance, wall thickness). Every scalar measurement it returns, and every error bound, is a units.Value. Positions are r3.Vec in millimetres.

decad asks sketch its 2D questions: whether a profile closes, whether a sketch is fully constrained or over-constrained, where two curves intersect, and how a set of curves divides a plane into regions. decad also builds private sketch scenes from its own recorded geometry and reads the regions back. When sketch reports a curve fragment as approximate, decad rejects the input instead of repairing it.

r3 provides vectors, frames and rigid transforms. decad does all coordinate math, including local-to-world conversion, through r3. r3 leaves shapes out of its scope; its README states the rule as "if it lives in ℝ³, it belongs here; if it is a shape, it does not."

units provides typed quantities (Value and Kind). decad and sketch share it, so lengths, angles and error bounds use one unit system.

Documentation

  • API reference: every public function, by task.
  • Data structures: the exported types.
  • examples/ (private decad-test repository): runnable Go examples with verified output.
  • docs/README.md: the index of user documentation.

License

This project is source-available, and is licensed under the PolyForm Noncommercial License 1.0.0.

  • Noncommercial use is free. Individuals, hobby and personal projects, research, education, nonprofits, and government may use, modify, and redistribute it at no cost, subject to the license terms.
  • Commercial / business use requires a separate license. Any use by or for a business, or for commercial advantage, is not permitted under the noncommercial license. To obtain a commercial license, reach out on Bluesky at @lestrrat.bsky.social.

Contributions

This repository does not accept external pull requests.