Chapter 8
Rounded edges
knotflow rounds edges exactly: with true circular arcs that touch both sides, not with many small facets. Rounded edges look better, feel nicer in the hand and break off less often; down on the print bed, a first layer that has spread out (the "elephant's foot") shows less at a rounded edge.
Which edge with what
| Edge | Tool | Example |
|---|---|---|
| corners of an outline or a profile | fillet(curve, r) |
cup, fidget_rings_rounded |
| rectangle with rounded corners | rounded_rectangle(w, h, r) |
|
| box with all edges rounded | rounded_box(w, d, h, r) |
rounded_plate |
| outline pulled up, rounded at top and bottom | rounded_extrude(outline, h, r) |
rounded_shapes |
| any edge profile around an outline | around(profile, outline) |
|
| boss with a fillet at its foot | boss(outline, height, r) |
rounded_plate |
| round an edge of a finished solid | fillet_edges(shape, point, r) |
edges, tee, soap_dish |
| chamfer an edge of a finished solid | chamfer_edges(shape, point, d) |
edges, picture_frame |
Behind these are two ways:
- Round the curve before it becomes a surface. Round the profile of a cup and you get a cup with rounded edges; round the outline of a plate and you get a plate with rounded corners. This is the simplest and sturdiest way; the first six rows of the table go like this.
- Round edges of a finished solid, also edges that
only came about through
unionordifference: the rim of a hole, the foot of a boss (fillet_edges,chamfer_edges, below).
A fillet is a rounding in an inner corner, such as the foot of a boss: there material is added. At an outer edge the rounding takes material away.
fillet:
rounding the corners of a curve
let profile = polyline([(0, 0), (20, 0), (20, 30), (0, 30)], closed: true)
export extrude(fillet(rectangle(40, 20), 3), 5) color "terracotta"
export extrude(fillet(rectangle(40, 20), [6, 0, 6, 0]), 5) |> move(x: 50) color "ochre"
export revolve(fillet(profile, p => if p.x == 0 then 0 else 4)) |> move(x: 110) color "sage"

fillet(curve, r) replaces every corner of a flat curve
with a circular arc of radius r. r comes in three forms:
- a number: all corners the same.
- a list, one number per corner; 0 leaves the corner
sharp. The order of the corners is shown by
corners(curve): a list of records{t, point, turn}in the direction the curve runs. For a closed curve, the corner at the start point comes last. Forrectangle(40, 20)that is: bottom right, top right, top left, bottom left. - a function of the corner's point:
p => if p.x == 0 then 0 else 4rounds all corners except those on the axis.
The third form is needed for profiles for revolve. A
profile that begins on the axis has corners there. Round them, and
turning makes a small dent in the middle of the floor and the top.
A cup with rounded edges
The example cup rounds the profile from chapter 6 before
turning it:
param height = 95 in 40..200 "height [mm]"
param wall = 2.4 in 0.8..6 "wall thickness [mm]"
param rounding = 1 in 0..3 "radius of the rounded edges [mm] (at most half the wall)"
let floor = line((0, 0), (32, 0))
let side = interpolate([(32, 0), (46, 0.45 * height), (40, height)])
let profile = thicken(chain([floor, side]), wall)
export revolve(fillet(profile, p => if abs(p.x) < 1e-6 then 0 else min(rounding, wall / 2))) color "terracotta"
thickenturns the outside into the profile of the wall (chapter 6).filletrounds all its corners except those on the axis: the edge at the bottom outside, the inner corner at the floor and both edges of the rim.abs(p.x) < 1e-6instead ofp.x == 0: a point that comes from an offset may not lie at exactly 0, but a tiny bit beside it.min(rounding, wall / 2): at the rim, two corners are one wall thickness apart. Two arcs of more than half the wall do not fit there side by side.
Upright edges
For the upright edges of a part pulled up, round the outline:
extrude(fillet(outline, r), h). The same goes for holes
with rounded corners (in perforate or as a
difference): round the outline of the hole.
Ready-made
shapes: rounded_rectangle, rounded_box,
rounded_extrude
let ell = fillet(polyline([(0, 0), (50, 0), (50, 25), (25, 25), (25, 50), (0, 50)], closed: true), 6)
export rounded_box(40, 30, 20, 4) |> move(z: 10) color "blue"
export rounded_extrude(ell, 12, 2.5) |> move(x: 35, y: -25) color "terracotta"
rounded_rectangle(w, h, r)isfillet(rectangle(w, h), r).rounded_box(w, d, h, r)is a box with all edges rounded, centred on the origin likebox. r must be less than half the shortest side.rounded_extrude(outline, h, r)pulls an outline up and rounds the top and bottom edge with r. Its corners must be rounded by more than r, the inward ones too: the L above has corners of 6 mm, the edges 2.5 mm. Otherwise it says "the profile reaches 2 inside the section …, which has sharp corners: round them by more than that first".
around:
carrying an edge profile around an outline
rounded_box and rounded_extrude are built
with around. around(profile, outline) carries
a profile once around a flat, closed outline, the way
revolve turns a profile around the axis. In the
profile,
- x is the distance outwards, at right angles to the outline,
- y is the height.
That way you can build any edge shape, for example a plate with a chamfer at the top:
let chamfer = polyline([(0, 0), (4, 0), (4, 6), (2, 8), (0, 8)])
export solid(around(chamfer, rounded_rectangle(40, 20, 6))) color "plum"

- The profile begins and ends at x = 0, that is on the outline itself.
There flat floors and tops come about, as with
revolveon the axis. solid(…)makes a solid of it (chapter 7).- The outline consists of straight lines and circular arcs: polygons,
rectangles, circles and whatever
filletmakes of them. - Inward corners must be rounded first, at least as much as the profile reaches inwards. Otherwise the profile would fold there: "the section has an inward corner near (20, 20): … round it first: fillet(section, r)".
- A profile that ends on the outline (x = 0) also needs a tiny
rounding at the outward corners; otherwise the rim runs
together into a point there.
aroundreports that with the advice to usefillet.rounded_boxrounds its corners by a thousandth of r for this.
Bosses with a rounded foot:
boss
Where a boss stands on a plate, the corner should be round on the
inside, a fillet at its foot. It makes the boss
sturdier and the part easier to print.
boss(outline, height, r) builds a boss with a rounded foot
of radius r, standing on z = 0; union puts it on the
plate:
param thick = 6 in 5..12 "plate thickness [mm]"
let plate = rounded_box(60, 40, thick, 2) |> move(z: thick / 2)
let peg = boss(circle(6), 12, 2) |> move(z: thick)
let hole = cylinder((0, 0, -1), (0, 0, thick + 13), 2.5)
export difference(union(plate, peg), hole) color "sage"
- The outline may also be angular, but with rounded corners:
boss(rounded_rectangle(20, 8, 2), 10, 1.5). A sharprectangleis reported bybosswith the advice to usefillet. - So that the union surely succeeds, the rounding dips a hundredth of r below z = 0, and the boss reaches a twentieth of r into the plate (rule 2 from chapter 7). The plate must therefore be thicker than r / 20.
- The roundings of two bosses must not overlap;
unionthen says "share a face". The centres must be further apart than two boss radii plus two roundings.

The example rounded_plate puts it all together: a plate
from rounded_box, four bosses from boss, holes
with difference, and an assert that reports
when the bosses come too close.
Edges of
finished solids: fillet_edges,
chamfer_edges
param corner = 6 in 1..12 "Rounding of the upright edges [mm]"
param foot = 3 in 0.5..6 "Fillet at the boss's foot [mm]"
let (w, d, h) = (60, 40, 12)
let (boss, height, hole) = (11, 14, 5)
let block = box(w, d, h) |> move(z: h / 2)
let part = difference(union(block, cylinder((0, 0, h / 2), (0, 0, h + height), boss)),
cylinder((0, 0, -1), (0, 0, h + height + 1), hole))
let upright = [(x * w / 2, y * d / 2, h / 2) | x <- [-1, 1], y <- [-1, 1]]
export part
|> fillet_edges(_, upright, corner)
|> fillet_edges(_, (boss, 0, h), foot)
|> fillet_edges(_, (boss, 0, h + height), 1.5)
|> chamfer_edges(_, (hole, 0, h + height), 1)
color "teal"

fillet_edges(shape, point, r)rounds the edge nearest the point. Instead of a point, a list of points works too; the edges are rounded one after another.- An outer edge loses its corner. An inner edge, such as the foot of a boss, gets a fillet: material is added there.
chamfer_edges(shape, point, d)cuts the edge off at a slant, d from the edge along each face.- The point need not lie exactly on the edge, but close to it: at most r away (or 1 % of the shape's size, if that is more), and clearly nearer to it than to any other edge (the next one at least one and a half times as far). Pointing at a corner where several edges meet gives a message.
Which edges work:
- straight edges between two flat faces: the edges of boxes, also where two boxes form an L; likewise between a plane and a cylinder along the edge (a pipe half let into a plate);
- round edges between faces turned about their axis: the rim of a hole (in a plane across the hole), the foot and the rim of a boss, steps on turned parts;
- curved edges: where two pipes meet, the rim of a hole at a slant, also one that breaks out through a side, the foot of a boss reaching over a plate's side (inner curved edges with ends must end at a flat face);
- runs of edges that go on into each other without a kink, sharing one face: the top edge of a box whose upright edges are rounded already, the rim of a slot or of a U-shaped notch, the floor of a pocket with round corners. A point on one of the edges is enough; the whole run is rounded, up to the next sharp corner or all the way round;
- straight edges meeting at sharp corners, rounded together in a list: the rim of a pocket with sharp corners, the top edges of a box with sharp upright edges. They get one tool, mitred at the corners like a picture frame. Rounded one after the other, a rim edge instead ends flush at the wall of the corner.
For the first two, the rounding is exact: a circular arc touching
both faces. For curved edges and runs of edges a ball of radius r rolls
along the edge. knotflow computes it at many places along the edge, the
stations, and spans a surface through its sections
there; where the edge bends more, the stations lie closer together. The
rounding dips r/100 into the faces (at r = 2 mm, 0.02 mm), so that the
Boolean operations find a clean cut, as with boss. Chamfers
work on all these edges.
let b = fillet_edges(box(40, 20, 10), [(20, 10, 0), (-20, 10, 0), (-20, -10, 0), (20, -10, 0)], 5)
export fillet_edges(b, (0, 10, 5), 2)
The ball rolls round roundings at least as large as the new one (here
5 mm). Over tighter ones the run is mitred, as if the corners were
sharp; that holds when only some corners are tighter too (example
mixed_run). A run that goes round all corners but one sharp
one ends at that corner against itself; fillet_edges
reports that.
let tee = union(cylinder((-50, 0, 0), (50, 0, 0), 12), cylinder((0, 0, 0), (0, 0, 42), 8))
export fillet_edges(tee, (0, 8, sqrt(12 ^ 2 - 8 ^ 2)), 3)

The examples show the cases one by one:
edges: a block with a boss and a hole, as above – upright edges, a fillet at the foot, the rim on top, a chamfer at the hole.tee: two pipes as a tee, the curved edge between them rounded.soap_dish: a soap dish. The top edge, the pocket's rim and its floor are runs of edges round rounded corners; one point each rounds the whole run.picture_frame: a picture frame. The window's edges meet at sharp corners and are rounded or chamfered together in a list, mitred.mixed_run: a run of edges over corners partly tight, partly wide.fidget_rings_rounded: rings turned from profiles whose cornersfilletrounds – the first way, where it is enough.
How that works inside, and why touching is the hard part, is in lesson 3.10.
What the messages say
The most common messages; all of them, with their remedies, are in chapter 14.
| Message | what is going on, what helps |
|---|---|
the roundings at both ends of the side near … overlap: make them smaller |
Two arcs on one side need more room together than the side is long: smaller radii. |
the rounding of 2 mm at the corner … does not fit between the corners next to it – at most about … |
The arc does not fit between the corners next to it; the message names the largest radius that fits. |
the section has an inward corner near … |
around: fillet the outline first. |
no edge near …: the nearest is … away |
fillet_edges: the point is too far from every edge;
point closer to the edge. |
the rounding of … mm does not fit at the edge at …: the faces next to it are too short or too curved |
The faces next to the edge do not reach as far as the radius, or they curve too much: make it smaller. |
the edge at … is only partly an edge of the shape |
Another part cuts the edge off, or three rounded edges would meet in a ball corner (see below). |
the edge at … is not an edge of the shape there |
There is no edge there, for instance at the rim of an earlier rounding: round in another order. |
Limits
What is listed above under "Which edges work" works, at corners too: mitred, over tight corners and in mixed runs. The following is not built:
- Ball corners. Where three rounded edges meet in a
corner, no piece of a ball comes about. There is a message
(
only partly an edge of the shape), or the corner is mitred. Ways round: for a box with all its edges rounded,rounded_boxis the way, for an outline pulled up with a rounded top,rounded_extrude. Otherwise the order helps: round the upright edges first, then the top as a run of edges. If the top is rounded at most as much as the upright edges, the ball rolls round the corners; if more, the run is mitred there. - Mitres at slanted walls. A mitre needs the same
section from both sides at each corner. If the walls stand at a slant,
or at different angles to the shared face, the sections differ; then
each edge is rounded on its own, and at an inner corner there is a
message (
edges rounded together meet at an inner corner). Edges rounded one at a time that meet at an inner corner do not work either; given together in a list, they are mitred. - A tight arc at the end of an open run
(
bends more tightly): choose the rounding smaller. - Inner curved edges that end at a curved face.
- The rounding of a rounding. The rims of a rounding
go on into the faces tangentially and are no edges any more
(
not an edge of the shape). What is to be rounded must be an edge when its turn comes: round in a fitting order. - Sharp wedges. Below about 28° the ball would touch
the faces too far from the edge (
meet at a sharp angle); only small roundings still fit, the message says up to which size. For a part at the origin none fits below about 22.6°, and below about 10° the edge is no longer found. Way round: round the outline's corner withfilletbefore pulling it up.
Some combinations of rounded solids are weak spots of the Boolean operations; they give a message or an open mesh:
- a
rounded_boxwith a smallerrounded_boxtaken away, to build a hollow box. The way to do that isshell(rounded_box(…), wall, open: [(0, 0, 1)])(chapter 6); - a rounded solid that a later Boolean operation cuts right along the lines where the rounding touches the faces (a plane through a rounded edge);
- two rounded boxes standing flush on top of or beside each other: better push them slightly into each other;
- two bosses whose roundings overlap;
- a shell whose wall is exactly as thick as the corner radius of the outline;
- on a solid turned at a slant, rarely: a very small rounding (about
an eighth of the one next to it or less) next to a large earlier
rounding (
almost share a face), or a mixed run of edges (touch where they cross). Way round: round first, then turn, or change one of the radii a little.
How the roundings come about is explained in lesson 3.9 (curves) and lesson 3.10 (edges of solids).