Pipe language guide
Learn Pipe, Zolid's modeling language - parts, steps, pipelines, units, Z-up coordinates and why every model is a watertight solid.
Pipe is the small language every Zolid model is written in. You type it in the studio, and your agent writes it through zolid-mcp. It is short on purpose: a whole part usually fits in a few lines that people and agents can both read.
units("mm")plate = box(80, 50, 4, z0=0) | fillet(vertical, 6)plate = plate | cut(cyl(2.6, 20, segs=48), at=[(-32, -17, 0), (32, -17, 0), (-32, 17, 0), (32, 17, 0)])This page explains the ideas. The Pipe reference lists every function.
Parts
A model is a set of named parts. Each part is a closed solid.
units("mm")base = box(60, 60, 5, z0=0)pillar = cyl(8, 40, z0=5)This model has two parts, base and pillar. They show up in the studio's Scene list, are exported together, and each can be inspected or exported on its own.
Assigning to a name again replaces the part, which is how you refine it step by step:
units("mm")base = box(60, 60, 5, z0=0)base = base | fillet(vertical, 8)Parts stay separate even if they touch. To make one solid out of two, join them with add.
Helpers
Names that start with an underscore are helpers. They exist only while the step runs and are never part of the model. Use them for cutters and building blocks:
units("mm")_hole = cyl(3, 20, segs=48)plate = box(40, 40, 4, z0=0) | cut(_hole)Pipelines
The | operator passes the solid on its left into the operation on its right. Read it as "then":
units("mm")cup = cyl(30, 70, z0=0, segs=96) | fillet(bottom_rim, 5) | shell(2) | color(0.95, 0.55, 0.3)"A cylinder, then round the bottom edge, then hollow it, then colour it." A line that starts with | continues the line before.
Every operation also has a function form: cut(plate, _hole) means plate | cut(_hole).
Steps
A Zolid project is a list of steps. Each time you press Run in the studio, or your agent calls build, one step is added. A step can be one line or a whole part.
Steps build on each other. Parts and numbers from earlier steps are still there (lists, macros and helpers are not: define them in the step that uses them):
units("mm")wall = 2.4body = box(80, 60, 30, z0=0) | fillet(vertical, 5)# --- step: hollow itbody = body | shell(wall)# --- step: add a lidlid = box(80, 60, wall, z0=0) | fillet(vertical, 5) | move(0, 70, 0)The history of steps is the project. Undo removes the last step, and you can edit any earlier step: Zolid replays the steps after it. Saving, syncing and sharing all work on this history, so a shared model always rebuilds exactly.
(In these docs, # --- step marks where one step ends and the next begins.)
What carries over between steps:
| Kind | Example | Kept for later steps? |
|---|---|---|
| Parts | body = box(...) | Yes |
| Numbers | wall = 2.4 | Yes |
| The unit | units("mm") | Yes |
| Macros | def peg(x) = ... | Yes |
| Named materials | mat("oak", color=(0.6, 0.4, 0.2)) | Yes: mat("oak") reuses it |
| Lists | holes = [(0, 0, 0)] | No |
| Helpers | _cutter = cyl(...) | No |
units("mm")def peg(x) = cyl(2, 10, z0=0, at=(x, 0, 0))a = peg(0) | mat("oak", color=(0.6, 0.4, 0.2), roughness=0.8)# --- stepb = peg(10) | mat("oak")A later def or mat with the same name replaces it for the steps after; parts made before keep what they had. Undoing a step removes everything it defined: its parts, macros and materials.
Every top-level mesh variable becomes a visible part. Name helpers and cutters with a leading _ (_hole = cyl(...)) so they stay out of the model, or del("name") them (del(["a", "b"]) for several).
Units
Numbers have no unit of their own. The project's unit decides what 10 means, and the default is metres. For anything you will 3D print, start with:
units("mm")The unit is written into 3MF and STEP files, so slicers and CAD tools open the model at the right size. STL and OBJ have no unit field and store plain numbers. Units are um, mm, cm, m, in and ft.
Coordinates
Zolid is Z-up: X runs left to right, Y runs front to back, and Z points up. The print bed is the XY plane at z = 0.
- Primitives are centred on the origin.
box(10, 10, 10)spans −5 to 5 on each axis. at=(x, y, z)is always a primitive's centre.z0=Zputs its base at heightZinstead:z0=0stands it on the bed.frontfaces point to −Y,backto +Y,topto +Z.- Rotations are in degrees:
rot(90, 0, 0)turns 90° about X.
units("mm")floor = box(100, 100, 2, z0=-2)cube = box(20, 20, 20, z0=0, at=(-30, 0, 0))ball = sphere(10, z0=0, at=(30, 0, 0))GLB files are converted to Y-up on export, as the format expects.
Watertight by design
Every part is a watertight solid: a closed surface with a clear inside and outside, and no holes, gaps or loose faces. That is what slicers need to print, and what booleans need to work reliably.
Zolid checks this on every step. If a step would produce a broken solid, or fails for any reason, nothing changes: the model rolls back to where it was and you get an error that names the line. You never end up with a half-applied step.
units("mm")plate = box(80, 50, 4, z0=0)# --- stepplate = plate | cut(box(100, 100, 100))# error: empty result, nothing is left: the tool covers the whole partAfter the failed second step, plate is still the 80 × 50 × 4 mm box.
Selectors
Operations that work on edges or faces take a selector that names them by meaning, not by number:
units("mm")block = box(40, 30, 20, z0=0) | fillet(vertical, 5) | bevel(top_rim, 1)tray = box(40, 30, 10, z0=0, at=(60, 0, 0)) | inset(top, 3, depth=-4)vertical picks the upright corner edges, top_rim the edges around the top, top the faces facing up. See edge selectors and face selectors.
Parameters
Numbers persist across steps, so a model can be driven by a few parameters at the top. Change one, and every step that uses it follows when the history replays.
units("mm")W = 100D = 70H = 40t = 2.4body = box(W, D, H, z0=0) | fillet(vertical, 6) | shell(t)body = body | add(cyl(4.5, H - t, z0=t - 0.1, at=[(W/2 - 6, D/2 - 6, 0), (6 - W/2, D/2 - 6, 0), (W/2 - 6, 6 - D/2, 0), (6 - W/2, 6 - D/2, 0)]))For repeated shapes, use list comprehensions and macros:
units("mm")def peg(x, h=12) = cyl(2.5, h, z0=3.9, at=(x, 0, 0))rack = box(90, 16, 4, z0=0) | fillet(vertical, 3)rack = rack | add(cyl(2.5, 16, z0=3.9, at=[(-30 + 12 * i, 0, 0) for i in range(6)]))rack = rack | add(peg(-40, h=24)) | add(peg(40, h=24))Good habits
- Set
units("mm")first for anything physical. - Stand parts on the bed with
z0=0; the printability check expects it. - Round before you hollow:
filletthe outside, thenshell, so the inside follows. - Cut through, overlap to join: cutters a bit longer than the part, added parts overlapping by 0.1 mm.
- Batch holes with
cut(tool, at=[...])instead of manycutcalls. - Use more segments for fit:
segs=48or more on holes, pins and threads. - Name parts for what they are (
lid,body,knob): names appear in exports and slicers.