A 3D Printed Christmas Ornament for 2026, created with Replicad
For Christmas 2026 I made a small tree ornament in Replicad to give to family and friends. Here is a 3D preview you can rotate and zoom:
The complete (Repli)CAD code to create it is:
const { draw } = replicad
const r = 5
const t = 5
const d = 20
const bW = 30
const bS = 20
const bI = 10
const pattern = [
[0, 0],
[50, 0],
[10, 20],
[40, 20],
[20, 40],
[30, 40],
[25, 60],
]
const main = () => {
// basically a capsule/'fully' rounded rectangle, extruded
const side = (l) =>
draw()
.movePointerTo([0, r])
.hLine(l)
.vSagittaArc(-2 * r, r)
.hLine(-l)
.vSagittaArc(2 * r, r)
.close()
.sketchOnPlane('XZ')
.extrude(t)
const section = (a, b) => {
const [aX, aY] = a
const [bX, bY] = b
const dX = bX - aX
const dY = bY - aY
const length = Math.hypot(dX, dY)
// I messed this bit up to start with by using atan and angle was too big for that
const angle = (Math.atan2(dY, dX) * 180) / Math.PI
return side(length).rotate(-angle, [0, 0, 0], 'Y').translate([aX, 0, aY])
}
const stand = draw()
.lineTo([bI, bS])
.hLine(bW - bI * 2)
.lineTo([bW, 0])
.close()
.sketchOnPlane('XY')
.extrude(5)
.translate([10, 0, -2.5])
let s = null
for (let i = 1; i < pattern.length; i++) {
const ns = section(pattern[i - 1], pattern[i])
s = s ? s.fuse(ns) : ns
}
return s.fuse(stand).fillet(1.2)
}
It is a relatively simple composition. The main parts are extruded ("pulled into a third dimension") fully rounded rectangles or capsules. The tricky part having come up with a zig-zag design was rotating perfectly to fuse (boolean OR) together, but just I wrote the code to do the shape horizontally then calculated the appropriate length and angle to position. A one-off stand is fused too, I guessed at a suitable size to slightly angle the tree and it seems to have worked well first time. Finally, I applied a fillet to round the edges.
Printing
For printing I used two colours per print, with the front half the of the tree in the first colour, the back in the second and the stand in the first colour.
Here are the first three prints, including one abandoned approach:
See Also
- 2025's 3D printed wreath
- Replicad
- My little course in Replicad. I recently expanded the explanations and added a cmd + k search feature.