Skip to main content

Building a Drafted Box

Finished drafted box

In this tutorial, you'll build a shelled box with a drafted central pipe and four drafted ribs, based on the original design by Too Tall Toby. It covers drafted extrudes, plane offsets, shelling with face filters, drafted cuts, the rib() feature, and circular patterns.

Create a new file called drafted-box.fluid.js in your project.

Setup

Start with the imports. This model uses core operations together with edge and face filters.

import { circle, cut, extrude, fillet, hLine, move, plane, rect, repeat, rib, select, shell, sketch } from "fluidcad/core";
import { edge, face } from "fluidcad/filters";
  • fluidcad/core — modeling operations (sketch, extrude, cut, shell, fillet, rib, repeat, etc.) and sketch primitives
  • fluidcad/filtersedge and face selection filters used to pick faces and edges by plane

Step 1: Drafted base box

Sketch the footprint on an offset plane

The base footprint sits on a plane offset 1.5 above the top plane — that way the body extrudes downward through the origin instead of starting at it.

sketch(plane("top", 1.50), () => {
rect(7, 5).centered()
});

plane("top", 1.50) builds a plane parallel to "top" and offset 1.5 along its normal. Inside the sketch, rect(7, 5).centered() draws a 7×5 rectangle centered on the origin.

Base footprint sketch

Extrude with draft and round the edges

const base = extrude(-1.5).draft(-8);

fillet(.750, base.sideEdges())
fillet(.50, select(edge().onPlane("top")))

extrude(-1.5) pushes the rectangle 1.5 units downward (along the negative plane normal). .draft(-8) tapers the side walls inward at 8° — a negative draft narrows the body as the extrude advances, giving the box its trapezoidal silhouette.

fillet(.750, base.sideEdges()) rounds the four vertical corners of the box with a 0.75 radius. select(edge().onPlane("top")) picks every edge that lies on the top plane (the top rim of the now-trapezoidal box, since its top face sits exactly on "top"), and fillet(.50) rounds those with a 0.5 radius.

Drafted base box with fillets

Step 2: Shell the top

shell(-.250, select(face().onPlane("top", 1.5)))

select(face().onPlane("top", 1.5)) picks the face that sits on the offset plane used in step 1 — the top face of the box. shell(-.250) hollows the body inward with a 0.25 wall thickness, removing the selected face so the box opens upward.

Shelled body

Step 3: Drafted pipe body

Sketch the pipe footprint

sketch(plane("top", 2), () => {
circle(2)
});

A new offset plane at "top" + 2 hosts a circle of radius 2. Putting the sketch above the box means the resulting extrude will pass through the open top and seat itself inside the shell.

Pipe footprint

Extrude with positive draft

const pipeBody = extrude(-2).draft(8);

extrude(-2) pushes the circle 2 units downward. .draft(8) is a positive draft — the opposite of the box. Where negative draft narrows the body in the direction of travel, positive draft widens it, so the pipe flares outward as it descends into the box.

Pipe body added

Step 4: Drafted pipe hole

Sketch the hole on the pipe's top face

sketch(pipeBody.startFaces(), () => {
circle(1.5)
});

pipeBody.startFaces() returns the face the pipe extrude started from — its flat top. Sketching directly on a face starts the cursor at that face's center, so circle(1.5) places a 1.5-radius circle at the pipe's axis.

Hole sketch on the pipe top

Cut with draft

cut().draft(-8);

cut() with no depth runs the cut as far as the underlying body allows. .draft(-8) tapers the cut walls inward at 8° — the same draft angle as the pipe's outer wall, so the bore narrows as it descends and stays parallel to the pipe's outside surface.

Pipe with drafted bore

Step 5: Add a rib

Sketch the rib spine

A single line on the front plane defines where the rib sits between the pipe and the inner box wall.

sketch("front", () => {
move([-2, 1.250])
hLine(.5)
});

move([-2, 1.250]) parks the cursor at x=-2, y=1.25 within the front plane. hLine(.5) draws a half-unit horizontal line — that's the rib's spine. It doesn't need to span the full gap between the pipe and the wall; .extend() will take care of that in the next step.

Rib spine sketch

Build the rib

rib(.25).parallel().extend().draft(-8)

rib(.25) builds a 0.25-thick rib from the spine. The chained calls do the heavy lifting:

  • .parallel() — extrudes the rib in-plane (perpendicular to the spine within the front plane) instead of normal to the sketch. The result is an upright wall standing inside the box rather than a flat strip lying on the front plane.
  • .extend() — pushes the spine endpoints outward until they meet the surrounding solids: the inner box wall on one side, the pipe's curved surface on the other. This is why the spine line itself only needs to be a small seed — the rib finds its own length.
  • .draft(-8) — widens the rib by 8° as it descends, matching the box's inward draft so the rib's outer edges stay flush with the cavity walls.

Single rib added

Step 6: Pattern the rib

repeat("circular", "z", {
count: 4,
angle: 360
})

repeat("circular", "z", { count: 4, angle: 360 }) rotates the most recent operation — the rib — around the Z axis four times for a full revolution. Called with no trailing target arguments, repeat automatically picks up the last operation in the scene, so a single line completes the four-rib arrangement.

Finished drafted box

Full code

// @screenshot waitForInput
import { circle, cut, extrude, fillet, hLine, move, plane, rect, repeat, rib, select, shell, sketch } from "fluidcad/core";
import { edge, face } from "fluidcad/filters";

sketch(plane("top", 1.50), () => {
rect(7, 5).centered()
});

const base = extrude(-1.5).draft(-8);

fillet(.750, base.sideEdges())
fillet(.50, select(edge().onPlane("top")))

shell(-.250, select(face().onPlane("top", 1.5)))

sketch(plane("top", 2), () => {
circle(2)
});

const pipeBody = extrude(-2).draft(8);

sketch(pipeBody.startFaces(), () => {
circle(1.5)
});

cut().draft(-8);

sketch("front", () => {
move([-2, 1.250])
hLine(.5)
});

rib(.25).parallel().extend().draft(-8)

repeat("circular", "z", {
count: 4,
angle: 360
})

What you practiced

  • plane("top", offset) — building a sketch plane parallel to a principal plane at a given offset
  • extrude().draft(angle) — tapering an extrude's side walls; negative draft narrows, positive draft widens
  • cut().draft(angle) — applying the same taper to a cut for matched-angle bores
  • select(face().onPlane(...)) / select(edge().onPlane(...)) — picking faces or edges by the plane they lie on
  • shell(thickness, face) — hollowing a body and removing a selected face to open it
  • rib(thickness).parallel().extend().draft(...) — building a stiffening wall from a short spine line that auto-extends to surrounding solids
  • repeat("circular", "z", ...) — circular-patterning the previous operation around an axis