Chapter 6
Vessels and walls
Cups, vases, pots, trays: for printing, every vessel needs a wall, equally thick everywhere, with a floor and a clean rim. This chapter shows the ways there, from the simplest to the most general.
| Task | Way |
|---|---|
| turned vessel (cup, pot) | shell(revolve(outside), wall, open: [(0, 0, 1)]) or
revolve(thicken(outside, wall)) |
| outline pulled up (tray, box) | shell(extrude(outline, h), wall, open: [(0, 0, 1)]) |
| smooth free form (loft) | shell(loft(…), wall), cut flat with
between |
| move an outline inwards | inset(outline, d), offset(curve, d) |
| holes in the wall | perforate(shape, holes) |
A wall is measured at right angles
How thick a wall is, is measured at right angles to it, not horizontally. For a slanted or curved wall that makes a difference: if you simply take 2 mm off the outer radius, the wall is thinner than 2 mm where it slants. All functions in this chapter therefore work with the offset: every point of the curve moves inwards by the wall thickness, at right angles to the curve. Why that is needed and how it is done is explained in lesson 3.3.
A cup in one line:
shell
param wall = 2 in 0.8..5 "wall thickness [mm]"
let outside = chain([
line((0, 0), (30, 0)), // the floor, from the axis outwards
interpolate([(30, 0), (40, 35), (34, 80)])]) // the wall upwards
export shell(revolve(outside), wall, open: [(0, 0, 1)]) color "terracotta"
- You draw only the outside, as a profile for
revolve(x = radius, y = height): from the axis along the floor, then up the wall. shell(shape, wall)puts the wall inside. The outside stays as drawn; the inside follows it at the same distance. The floor becomes as thick as the wall, and the rim at the top is flat. Where the profile bends inwards, the inside becomes round.
Which ends stay open is said by open: with the
directions they face:
- without
open:everything is closed, a hollow solid – as when hollowing in a CAD program, where one picks the faces to remove. A sphere becomes a hollow ball. open: [(0, 0, 1)]: the top end open. The profile above ends at the rim, not on the axis; that is where the cup opens.open: [(0, 0, 1), (0, 0, -1)]: open at the top and the bottom, a tube.
A direction no end faces is an error that names the ones there are ("its ends face (0, 0, 1)").
The example planter shows a plant pot with a set-in foot
and a ledge under the rim, all from one profile and one
shell.
Made yourself: thicken
thicken(curve, wall) turns a curve into a narrow, closed
band: the curve, its offset beside it, joined straight at the ends.
Turned, that is a cup as well:
param wall = 2 in 0.8..5 "wall thickness [mm]"
let outside = chain([
line((0, 0), (30, 0)),
interpolate([(30, 0), (40, 35), (34, 80)])])
export revolve(thicken(outside, wall)) color "terracotta"
The band lies to the left of the direction of travel. A profile that runs from the axis outwards and then up has the inside of the cup on its left; a negative value puts the wall outside.

The difference is at the rim: thicken cuts the wall off
at right angles to it, shell flat. In return, the result of
thicken is a profile, an ordinary curve.
You can keep working on it before turning it, for instance round its
corners with fillet (chapter 8, as the example
cup does).
Trays and boxes:
shell with extrude
let section = rounded_rectangle(80, 50, 8)
export shell(extrude(section, 25), 2, open: [(0, 0, 1)]) color "teal"

Without open: you would get a closed hollow box;
open: [(0, 0, 1)] leaves the top open. Inside, the corners
become round where the outline bends inwards (see the example
tray, with a corner cut out).
Free forms: shell with
loft
A smooth surface that is closed all round also gets a wall with
shell, for example a loft through curved
sections. Two differences from turned profiles:
- The ends stay open: a loft through smooth curves
has no flat lid to close them with.
open:works for turned and pulled-up shapes, and for lofts through polygons. - The rim follows the wall and therefore stands a little beyond the end plane where the wall slants.
between(shape, z0, z1) solves both: it cuts a shape flat
at z0 and z1. You build the loft a little longer than you need and then
cut it to size. A floor is put in with union (chapter
7):
param height = 100 in 40..200 "height [mm]"
param wall = 1.6 in 0.8..4 "wall [mm]"
// a section with six waves, at height t · height (t = 0 … 1), turned a little
fn wavy(t) = interpolate([radius(a) * (cos(a), sin(a)) | a <- range(0, 360, step: 10)], closed: true)
|> rotate(t * 40) |> move(z: t * height)
fn radius(a) = 30 + 4 * cos(6 * a)
// from t = -0.1 to 1.1: a little longer than needed, then cut flat
let skin = loft([wavy(t) | t <- linspace(-0.1, 1.1, 7)])
let wall_only = between(shell(skin, wall), 0, height)
// the floor: the lowest section, reaching into the middle of the wall
let floor = extrude(inset(wavy(0), wall / 2), wall)
export union(wall_only, floor) color "sage"

The floor reaches about into the middle of the wall, not exactly to its inside. That way the two solids cut each other cleanly instead of only touching (chapter 7 says why that matters).
Angular lofts
A loft through polygons (polygon,
polyline(…, closed: true)) has edges that twist with the
loft. It gets a wall from shell too, and here
open: works: without it both ends are closed,
open: [(0, 0, 1)] leaves the top open; a flat floor stays
at the bottom.
fn ring(t) = polygon(6, 30 * (1 - 0.3 * t)) |> rotate(t * 40) |> move(z: t * 100)
export shell(loft([ring(t) | t <- linspace(0, 1, 5)], degree: 3), 2, open: [(0, 0, 1)])

The wall is exact to a hundredth of its thickness. If the loft twists
so much that this does not work, shell says so.
Moving outlines:
offset and inset
inset(outline, d)moves a closed outline inwards by d (outwards with a negative d), whichever way it runs.offset(curve, d)moves a curve by d to the left of its direction, seen from above. It works for open curves too.
Corners stay sharp inside and become round outside, like a pen running along the curve at a fixed distance. A frame around a recess:
let outline = rounded_rectangle(60, 40, 6)
let border = inset(outline, 3)
export difference(extrude(outline, 4), extrude(border, 4) |> move(z: 2))
Holes in the wall:
perforate
perforate(shape, holes) cuts holes through a wall. Every
hole is an outline that is pushed straight through the wall. For the
most common case, horizontally from the axis outwards, there is
radial_hole(outline, angle, height):
param height = 90 in 50..150 "height [mm]"
param radius = 35 in 20..60 "outer radius [mm]"
param wall = 2 in 1..5 "wall [mm]"
param hole = 4 in 2..8 "radius of the holes [mm]"
let outside = chain([line((0, 0), (radius, 0)), line((radius, 0), (radius, height))])
let cup = revolve(thicken(outside, wall))
// three rows of twelve holes, every second row turned by 15°
let rows = [20, 40, 60]
let holes = [radial_hole(circle(hole), a + 15 * (i % 2), z)
| (i, z) <- enumerate(rows), a <- range(0, 360, step: 30)]
export perforate(cup, holes) color "blue"

- In general, a hole is a record
{shape, at, along}: the outline, a point outside the material, the direction in which it is pushed. It goes through the first wall it meets. perforatetakes a surface closed around (revolve(…),loft(…)), a solid of faces (shell(revolve(…)),solid) or a result ofunion,differenceorintersection– a pot with its floor,shellof a box made withextrude(adifferenceinside); the result is a solid, which can be combined further (union(perforate(pot, holes), handle), chapter 7).- The hole must go in through one face and out through one face – flat
ones too (the lids of
extrude). A hole over an edge, a crease or a line where combined solids meet is reported; for that there isdifference(chapter 7). - Round corners on angular holes: round the outline with
filletfirst (chapter 8).
The example air_pot drills 874 honeycomb cells into a
plant pot this way; lesson
3.5 explains how it works.
Holes, then additions, then openings
A pot with many holes, ribs and a tube is fastest in this order: join
the solids and punch them with perforate, then add what is
added, and last take away with difference what has to go
through everything – in short (solids − cutouts) ∪ additions −
openings:
param radius = 30 in 20..60 "Radius at the bottom [mm]"
param wall = 1.6 in 1..4 "Wall [mm]"
let side = chain([line((0, 0), (radius, 0)), line((radius, 0), (radius + 5, 40))])
let pot = revolve(thicken(side, wall))
// 1. the holes, while the pot is still smooth
let holes = [radial_hole(polygon(6, 2.5), 20 * k + 10 * (row % 2), 12 + 8 * row)
| row <- [0 .. 2], k <- [0 .. 17]]
let punched = perforate(pot, holes)
// 2. what is added: a rib covers only the holes it touches
let rib = box(8, 1.5, 32) |> move(x: radius - 2, y: 3, z: 18)
// 3. what has to go through everything, last
let opening = cylinder((radius - 8, 3, 20), (radius + 12, 3, 20), 2)
export difference(union(punched, rib), opening) color "terracotta"
- Holes an addition does not touch stay trim loops and cost next to
nothing in the
union, even 16 000 of them. - A hole an addition touches is drilled as a prism, and the addition fills it where it lies. If it should go through the addition, it belongs with the openings at the end.
- Each opening is a whole Boolean cut: such a hole costs time and
triangles like twenty to a hundred punched ones. So take only the holes
that really go through as openings, and
perforatefor all others.
The example plant_pot builds a whole pot this way: wall,
floor and tower with over 800 holes, twelve ribs, a water level tube and
its bore.
Combined
shapes: shell after union and
difference
shell also hollows solids put together with
union, difference or
intersection. Each part must be made from a surface:
turned, pulled up, or a closed smooth surface. A combined solid is
closed all round; open: names the directions of the ends
that should stay open.
let body = revolve(polyline([(0, 0), (30, 0), (30, 80)]))
let handle = torus(20, 5) |> rotate(90, axis: (1, 0, 0)) |> move(x: 30, z: 40)
export shell(union(body, handle), 3, open: [(0, 0, 1)])

- The handle is hollowed too, and its inside is open to the mug: the
wall is equally thick everywhere. To keep it solid, add it after
shell:union(shell(body, 3), handle). - With a difference, a wall stays around what is taken away as well: a box with a hole becomes a hollow box with a tube through it.
open:opens only ends whose middle lies on the outside: for a bottle of body and neck, only the neck opens, the shoulder stays closed – also with the neck off the middle. A cup with a rolled lip (a torus at the rim) opens; the opening keeps the wall's thickness from the lip.- Parts standing flush on or beside each other get no wall between them. Where parts overlap only in part, the wall is rather thicker, never thinner.
- A part nowhere thicker than two walls (a small block, a thin web) has no inside: it stays solid, the rest becomes hollow.
What does not work, and what the message says
The most common messages; all of them, with their remedies, are in chapter 14.
| Message | what is going on | remedy |
|---|---|---|
the offset 6 mm leaves nothing |
The outline is narrower than two wall thicknesses: nothing is left inside. | thinner wall or larger shape |
the offset 3 mm falls apart near (15, 3) |
At this place the shape is narrower than two wall thicknesses (a neck, a notch); the offset would fall into two pieces. | make it wider there or the wall thinner |
the wall leaves nothing inside: it is thicker than the solid |
shell with a wall thicker than half the shape |
thinner wall |
open: … is not the direction of an end of this shape |
open: names a direction no end faces |
take one of the directions named |
a loft through smooth curves keeps its ends open … |
open: on a loft through curves |
between, a floor with union |
hole 0: runs over a line where two of the combined solids meet |
a hole of perforate crosses where two combined solids
meet (a wall joining its floor) |
move the hole away from that line or make it smaller; through the
joint itself only difference (chapter 7) |
the profile crosses itself near … |
The profile for revolve crosses itself, often because
the wall is too thick at a tight bend |
thinner wall, gentler bend |
Not possible yet:
- a wall for a loft through curves with corners (arcs and corners mixed);
- a wall for a partly turned solid
(
revolve(profile, 270)); - very thin walls on shapes with edges: a wall thinner than about 0.02 mm can cross itself when it is split into triangles; no printer prints that thin anyway.
More in lesson 3.8.