Rebounder Tech Blog

Written by the people who actually run these systems in production.

Writing 3D Models as Code Instead of Mouse Work

Published About 3 min readBy the Rebounder engineering team — the people who operate these systems

This article may contain affiliate links. Its content is not affected by advertising.

In short

Write a 3D model as code and you can state dimensions to the millimetre, mass-produce size variants by changing one parameter, and keep the design itself under git.

Why write it as code

The first thing you get stuck on after buying a 3D printer is usually modelling. Open Blender or Fusion and the business of dragging faces and rounding corners with a mouse is, to a head used to programming, harder rather than easier.

So I changed approach and decided to drop the mouse and design in code. Three reasons.

  • You can state numbers outright: “80 mm wide, 65° tilt” (no drift from eyeballing it)
  • Change one parameter and you can mass-produce as many size variants as you like
  • The design is text, so you can diff it in git. Break it and you can go back

Being able to write a 3D model as programming rather than as sculpting is what code CAD really is.

Example ① a stand with a charging slot, in OpenSCAD

OpenSCAD is CAD for programmers: you build shapes by combining cuboids and cylinders with difference() (cutting away) and hull() (wrapping).

Two things I worked on.

The charging slot — a passage from the base underside through the front lip, so it can sit there with a USB-C cable still plugged in.

A zero-support design — the backrest’s slope is held to 25° from vertical (a 65° tilt), well inside the 45° overhang rule, so it prints cleanly with no supports.

And rewriting phone_width alone adapts it instantly to a different target. You end up in a state where measuring and entering a number is faster than shopping for something that fits.

Example ② emitting STL from equations in Python

This one goes all the way. Using only Python’s standard library (math and struct), with no CAD software at all, I wrote an STL from scratch.

All it does is stack a star-shaped cross-section up the height axis, rotating it a little at a time, and stitch the inner wall, outer wall, base and rim out of triangles. A taper narrowing the radius toward the top keeps this support-free too.

Change TURNS (the number of twists) or N_POINTS (the star’s points) and an entirely different shape appears instantly. The shape is an equation, so the parameters are the design.

Choosing between them

Target What to pick
Mechanical parts such as stands, cases and jigs OpenSCAD (fits adding and subtracting blocks)
Curved, algorithmic forms Python (code wins where equations decide the shape)

Roughly “square practical objects = OpenSCAD / curves = code” will not steer you wrong.

Where it got hard

The direction of STL normals — a triangle has a front and a back, and a flipped one breaks the model at print time. Writing by hand in Python meant writing my own pass to orient every triangle’s normal outward. Quietly the biggest hurdle.

Nailing the 45° rule — printing without supports is the right approach, but “is the slope steep enough” has to be calculated at design time, every time. Compromise and it droops.

Unit drift — parametric design lives on real measurements. Enter them by eye and you are a few millimetres out. Calipers were close to essential.

When it suits and when it does not

Suits — you can program, you are bad at sculpting with a mouse, you want to mass-produce size variants of the same shape.

Does not suit — carving organic curves by hand. Blender or something clay-like suits that better. I do not want to build a human body in code, honestly.

Frequently asked questions

Q1Should I use OpenSCAD or Python?

Mechanical parts such as stands and cases suit OpenSCAD, which fits the idea of adding and subtracting blocks. Curved surfaces or algorithmic forms like a vase are stronger in Python, where equations decide the shape. Square practical objects to OpenSCAD, curves to code, and you will not go wrong.

Q2How do I print without support material?

Check the overhang angle at design time. Keep the slope well inside the 45-degree rule and it prints cleanly with no supports. It does need calculating every time, though, and compromising makes it droop.

Q3What to watch for when writing STL directly in Python?

The direction of triangle normals. A triangle has a front and a back, and a flipped one breaks the model at print time. Writing by hand means writing your own pass that orients every triangle's normal outward.

What this article is based on

  • Markdown file

Every claim in this article comes from the records above. The repositories we operate are private so we cannot link to them, but which file, which lines, and at which commit we read them is recorded for every article. Nothing here is written from guesswork.