The printability gate
Every build is checked before it is written, and a tile that fails is reported as failed (exit code 3) even though its files are still written for inspection.
- Watertight after the mesh is reloaded at float32, the precision an STL stores.
- Nothing lost: every part is joined to the tile. Sealed voids are filled and reported, not counted as lost.
- Overhang: 55° from vertical is the target for every element. Faces between 55° and 65° are the band: allowed in small patches, up to 0.1% of the tile's downward-facing area, and painted orange. Faces past 65° are overhang, painted red, and allowed only up to another 0.1%. More than either budget fails. Rock (rocks, stones, boulders, pebbles and cliffs) is the one exception: a rock’s underside may be rough, so its faces in the band are painted orange but not counted, and rock may lean to 65° anywhere; past 65° it is red and budgeted like anything else. Both angles are the printer profile's (
overhang 55,steepest 65in the printer); 65° is where a 0.2 mm layer steps out 0.43 mm, just under one 0.45 mm line. - A gap narrower than the printer's gap (0.2 mm) counts as solid, so the lip over a fine joint is not an overhang.
- The gate is never loosened, and geometry is never culled to pass it. A failure is fixed where the geometry is made.
- The gate’s repairs (pinch vertices moved, sealed voids filled, slivers removed, edges collapsed, loose bodies dropped) have a budget for each library tile in
crates/dt-eval/tests/baseline/library-db.tsvthat cannot rise: the baseline check fails above it, and rewriting the baseline only lowers it. A budget is raised only by editing the file by hand. A tile’s counts are its build on the seed it writes. A repair count is noisy (it changes two or three times over when the grass blades overlap in another arrangement, as they do when a line moves), so the budgets were recorded as the worst of four seeds, which leaves the room. - An element meets 55° by construction. Where it cannot be sure (a part on a curved surface, parts lying over each other), it asks the gate's own test of the part in its final pose, on what it rests on, and shrinks or drops the part then (
dt_kit::hangandfit). - Tiles print base down, with no supports. See printing.
Tiles
- A tile is the whole printed piece; a square is one grid unit (35 mm for DungeonBlocks, 25.4 mm for OpenLOCK); a cell is one subdivision of the heightmap. A square is never called a tile, and densities are per square.
- DungeonBlocks is the default base; OpenLOCK is the other. One document builds for either, and every size it writes scales with the square.
- Dirt reaches no higher than
$dirtEdgeHeight,3.4dmm, at any tile edge (its grain is set into that height, so its rim's high points reach it and its low points lie up to the grain's depth under it) and water meets every tile edge at$waterEdgeHeight, so any two tiles sit side by side: the library pins both atedges(library/parts/edges.dtile), and a tile's own pin wins where it writes one. A built floor (flagstones, planks) meets every tile edge flush at$floorEdgeHeight,7.4dmm, with no edge-round and its faces at the plane carrying the material's grain (never past it, at least 15% of each face within 0.1 mm of it), so floor tiles meet with no step and an outdoor tile beside one is a 4 mm step down. The standard heights are inlibrary/parts/heights.dtile. - A pieces body (the floors and the cliff) is made to fit its band: each slab, board or stone is drawn inside the band as it is made and never trimmed after, and one that still misses is a bug the build refuses (
dt::band). Its grain never rises above the band's top. A field body (dirt, water) is clamped point by point and cannot miss. - The stack is built in the order it is listed: each entry stands on the terrain laid so far, and what is listed after it is laid over or beside it (a dirt after a tree banks against the trunk; grass after the water keeps off the wet ground; a dirt after the water lies over it; water is built where it is listed, with no rule that it comes last). The plan never reorders: it refuses an order it cannot build (
dt::order). Only the lift, which comes after the last surface, andbase, built last, are placed by what they are. - Dirt behaves like dirt: it lies in its region on whatever surface is under it (ground, a floor, a cliff's stones, the tops of loose rocks listed before it), measures its band from that surface, and stays only where the surface is flatter than its
maxSlope(35°) and is not laid at a drop (the high side of a step deeper than 1 mm, or within 1.5 mm of one); a rise is no drop, so dirt banks up to the foot of a stone. It slides off steeper faces, so a cliff's faces are clean, and it never bridges a slit between stones. Nothing in it knows about cliffs. - Dirt's edge-round is the material's own, 0.2 mm at the 35 mm square on every printer: a drop of the top at the rim, cut from the sharp corner at the edge height, mitred at the tile's corners, tapering to none on dirt thinner than the printer's skin. Water has none, and floors have none except weathered flagstones (
texture=worn), whose worn edges take a round of their own. Edge height less the round is never under the tide's crest. The tile's four vertical corners are rounded 0.5 mm in plan at the 35 mm square, scaled with the system like every size (0.36 mm on OpenLOCK), and the base's four corners take the same round, so the terrain sits flush on it. - The tile's four sides are height fields over their vertical planes: a face is only ever set back behind its plane, never past it, so tiles butt and slide into clips and onto boards. Dirt's sides carry the top's grain as low relief, up to 0.6 mm deep at the 35 mm square (never under the printer's one line, 0.45 mm), continuous over the edge-round and round the rounded corners (where a face is set back behind both planes), with at least 15% of a face within 0.1 mm of the plane, fading to zero over two layers (0.4 mm) at the base, below the edge-round and at each layer boundary. No face leans out past the overhang angle, by construction. Water's side is smooth; where no dirt reaches an edge there is no relief on it. No grass blade crosses the plane.
z = 0is the top of the base; the base owns everything below it. A tile with nobaseline has no base: it prints flat on the bed from zero up, and the connector rules do not apply to it.- Nothing is clipped at the tile edge: a thing near the edge is moved or shrunk back until it fits inside.
- A tile is named by its file and nothing else: the
tilenode takes no name, and seeds are keyed by the seed and the stack, never the file name, so renaming a tile never changes it. - Lines meet the next tile square, at a seam. A line is one smooth curve through its points. Where an end is exactly on a tile side it leaves along the side’s normal, and exactly on a tile corner along its bisector (45° to both sides); each end is decided on its own, with no lead and no flatness rule. A point on a tile side is on one of its square’s seams, the same places on every square edge (0, a third, a half, two thirds and 1: the table on the tile system page, closed under a quarter turn), or it is
dt::seamnaming the column, row and side. Squares are named column then row from 1, C1 R1 the north-west one. A third is written exactly,1sq/3, or by its word (nnw,n,nne, …;nw ne se sware the tile’s corners;"nnw(2)"on a longer side), which the program reads from the edge contract, not from a list of its own. The point partway along a side where two squares meet is not a seam. A point within 1 mm of a side but off it isdt::near-edge; a range on a side isdt::edge-range. A line may opt out withcurve=straightorends=free, a point withheading=orcorner=#true, a tile withseams=free. Nothing smooths across a map seam: a tile is built, cached and printed alone. - File names and edges follow the tile system.
Builds
- Deterministic: the same document, seed and system give the same bytes on one machine, at any thread count, and the same look on any machine.
- The same bytes in the browser as in the program. A tile builds to the same mesh natively and in the browser bundle;
cargo xtask paritybuilds a fixed set both ways and fails on any difference in a tile’s STL hash, audit numbers or verdict. What holds it: every transcendental function in the engine (sin,cos,tan,asin,atan2,exp,ln,powf,cbrt,hypot, and theirf32forms) is thelibmcrate’s, never std’s, which is the platform’s libm natively and another one in the browser (clippy’sdisallowed-methodsinclippy.tomlrefuses the std methods anywhere, tests included); glam is built withscalar-math, since its NEON and SSE dot and cross sum in another order than the scalar code and move a ray’s hit; and obvhs is built without itsparallelfeature, since its parallel build lays the BVH out differently from the sequential one the browser runs, and a tie at a shared edge then goes to another triangle. Manifold and Clipper2 are compiled with-ffp-contract=off. A change that makes the two differ is fixed where it is made, never by listing the tile as a known difference. - A cache never changes what is built. A finished build is kept in the cache folder (
$DT_CACHE, else the platform's cache folder, at most 4 GB) under a hash of everything it read: the tile and every file it used, the system, the printer's numbers, the seed, the resolution and the engine (the version and a hash of the source that decides what a build makes). A hit is the same bytes as a fresh build, any input change misses, and a resolution is never answered with another's. A damaged entry is reported and the build that replaces it is real; nothing in the cache is committed, and an entry from another machine is not trusted. See the cache of builds. - Plates are made from full builds only. A print list is packed by each piece's real footprint, the printer's filament slots are checked before any build, and only a full, gate-checked build is exported; a low or super-low build is never written. A piece that fails the gate is named, and the export exits 3. See Plates.
- An edit never adds a mistake. Every edit of a tile, a print list or an inventory is made by
dt_doc::ops::apply, whose result is read again: if the new text has a mistake the old text did not have, the edit is refused with that mistake and nothing is changed. The page sends what it wants changed (a node, a control, a typed value) and never writes KDL or computes a byte offset itself. - The inventory is a log. What you have printed is a line a print, a loss or a rename in
inventory.dinv; lines are added, never edited away, and every count is worked out from them and never stored. A piece is the same piece when its tile, seed, system and colour are the same; DungeonBlocks and OpenLOCK never count for each other; a failed print is kept and does not count; edited since printing is information only. A file that is not understood is never added to. See Inventory. - A map keeps personal state out. A map says what the scene is (its pieces, their places, turns, bottoms and seeds); the inventory says what you own; the plates say how it prints on your printer today. The backdrop is a preference of the viewer, kept in the browser and never written into a document, so it cannot change what prints. A piece's
bottomis the height of its tile's zero above the map's ground (0 buries the connector), every piece snaps to the squares of its own system andz = 0is the same ground for all of them, and a crown over a taller neighbour is a note, never a refusal. - The library is files on disk, read from the checkout's
library/when run inside it, else$DT_LIBRARY, else the copy installed beside the program. - Documents are KDL v2 underneath:
.dtile(a tile, a part, a printer profile or a palette),.dmap(a print list or a map) and.dinv(an inventory). Each starts withdharmatiles version=…, whose major number is the format; this program reads format 1 only and refuses a format 0 document (dt::format-0, whose help names release 1.0.0, the last that could carry one over) and a newer one. - Every length is written with its unit (
8dmm) and every angle withdegorrad;dmmis 1/35 of a square and scales with the system,mm,inandlayerare printed lengths and never do. Kinds are checked before any build. See the language guide. - Positions count from the north-west corner, across then down, in parentheses with units (
"(0.65sq, 0.5sq)"). A$name is read from the context a formula is called with; a plain name is declared once where it is written;checkrefuses a read of a name an element does not set before any build. Every frame is a region and regions nest; the tile has no parent.
Elements
Each element page ends its reference with the rules that element always keeps:
- dirt, grass, reeds, water, flagstones, planks
- rock, cliff, wall, tree
- How they share a tile: composing
- Every control has one source for what it is where nothing is written. The editor shows every control of an element, written or not, with the value a build uses and where it comes from, and never “not set”. A value an element works out for itself (a wall’s stone size from its style) is read off the fields the element is built with (
Element::shown), a plain default is the schema’sdefault, and where there is no value the schema’sabsentwords say what leaving it out means. The page never works one out, and a control with none of the three is an error (crates/dt-eval/tests/tiles/unwritten.rsruns every element).
Pictures
- Every render paints overhang red and the band orange. On a model those colours mean overhang and nothing else; the interface's own red (
--err) marks errors and destructive actions. - Tiles are shown on the plate (#D9E0EB), whole, never cropped.
- The site and the preview share one visual system.
The ledger
- One file lists every known violation of the language principles.
ledger.kdl, at the repository root, holds oneviolationnode for each:violation "audit:layer-unit" principle="one-job" found="94927dcd" note="…". The id is<category>:<slug>, the category one of a closed list (audit,hole,collision,disagree) and any other form refused when the file is read; it is what a test looks up (hole:<kind>:<form>,collision:<word>,disagree:<case>,audit:<slug>), the principle is one word of a closed list, andfoundis the commit the finding was recorded against. The file is read in one place,dt_doc::ledger::Ledger. - The ledger only shrinks. A test reads its known exceptions with
Ledger::expect(id, still_broken): a listed case that now works fails (“fixed: remove it fromledger.kdl”), and a broken case that is not listed fails (“new violation”). An id is added only by an audit commit, one that changesledger.kdlalone;cargo xtask checkfails a commit that adds an id and changes any other file, and names it. - A release needs an audit commit newer than the last release tag, or
--skip audit "reason", whose reason is written into the changelog entry.
Words
- Every word is a row of one registry.
crates/dt-lang/src/words.rsholds a row (Word: the word, its one meaning, its kind) for each keyword, control, choice, function, unit, element, service verb, command, flag and file kind. The decoder matches a keyword by its constant (words::TILE), never by a string, as every diagnostic uses its code by constant; a table that lives elsewhere (a function's argument count, an element's controls, the command line's clap derive) is checked against the registry, and the guide’s cheat sheet is written from it. - One word, one job. The vocabulary tests fail on a word used and not registered, a word registered and not used, a word registered twice in a kind, a keyword written as a string in the decoder, a tile-language word that is two kinds of word, and a control name that measures two things. A word that already does two jobs is listed in
ledger.kdlascollision:<word>, and the test allows exactly those.
The project
- Nothing is swallowed and nothing is hidden: your mistakes are shown where you made them, the program's are shown loudly, and no fallback quietly changes what is built. See errors.
- Every piece of data has one typed definition. A record the program makes (a build’s result, a message, a plan, a mesh’s header) is one Rust type with serde, in the lowest crate that owns it, made by one constructor and read by deserializing it; when the page or the site reads it, its TypeScript type is generated from that one type, never typed by hand. No record is built from
json!literals for someone else to read back, nothing is read by string key (v["audit"]["triangles"]) or held as untyped JSON, no struct, script or test mirrors a type that exists, and no field is optional because some copy leaves it out. A file format (the baseline’s TSV, an STL) is read and written in one place, on its type. Untyped JSON is only for data with no schema. - The loop is kept fast: a warm build under a minute,
cargo xtask checkunder two, a cold build under five,check --fullabout ten. Every command and every step of a check is timed against its budget and says when it is over, and an over-budget cycle is the next task. See performance. - dharmatiles is a Rust program. The only other code is the paint organizer and two STL helpers in
extras/, which are not part of the program. - This site is the reference for the tile language: the guide, and one page per element. Each element page's controls table is generated from the program (
cargo xtask docs), and a new element needs its page before it ships. - Every example on the site is a
.dtilefile underdocs/examples/that its page shows and a test builds (an example that is meant to fail names the code it must give), and its picture is named by the build’s cache key, so a changed example has a new name andcargo xtask docs --checkfails until the page says it. Examples are not library tiles. - Every code sample in the guide is checked or marked. On the concept pages under
docs/guide/, a sample is either a whole document (<pre data-doc>), whichcargo xtask docs --checkruns throughdharmatiles checkso it cannot go stale, or marked as what it is instead:data-fragment(a piece of a document),data-output(what the program prints) ordata-grammar(notation). An unmarked sample, or a whole document the program refuses, fails the check. Samples end a line on a seam only (a compass word such aswswor an exact fraction such as2sq/3), as the program requires. - One source for each thing the guide says: the cheat sheet, each page’s list of the errors it explains, the guide list in the margin, the redirects from the old long guide’s anchors and each element page’s “Seen from the language” line are all written by
cargo xtask docs, never typed; a paragraph two pages need has one owner and the other page links to it. - The site describes the program as it is. How it got here lives in git history (the tag
before-rust-onlyholds the old design notes and the Python library). - The preview only touches folders you own and only on your say: a folder becomes a place through the system's own folder chooser, which the program shows (the page never types or sends a path), and every call that changes a file checks that it is inside such a place, that its real path is, and that it is a tile document or a folder. Delete is the Trash, never a hard delete. See Places and folders.
- The error rule is the compiler’s:
clippy.tomlrefusesResult::ok,unwrap_orand its relatives, and every#[allow]carries areason(see errors). The marked silences are counted bysilences_are_capped; raising its number is a visible choice. - Tests run locally:
cargo test --release --workspace, with clippy and rustfmt clean. - Everything in the repository, the code and the tile library, is under the Peer Production License (
LICENSE): non-commercial use, change and sharing with credit and under the same licence; commercial use only by worker-owned co-operatives. Manifold keeps its own Apache-2.0 and MIT licences inthird_party/manifold-csg-sys.