Fitted box design generator underway

I’ve been working on one for a while — has a few options:

Detail view:

If someone would like an STL — just let me know what dimensions you’d like to cut, what features, and so forth and I’ll try to work one up and post it.


Round, 3" x 3" x 1" with lid and divider:

cncboxfitted_round_3x3_lid.stl (874.2 KB)

cncboxfitted_round_3x3_bottom.stl (563.6 KB)


And here’s an animation which shows some of the options and parameters:


Okay, bought a nifty mechanical pencil and an assortment of leads:

and while the pencil fits neatly in a slot in my bag, mislike the pencil lead boxes rattling around loose (and worry about breakage or loosing them), so we need to make a box.

Fortunately, the lead cases are shaped so that they nest efficiently:

so we just need a box with a single pocket which is: ~7.25mm deep, ~56.5mm at its widest and ~76.75mm tall (probably we’ll swap those two numbers)

We have some bamboo flooring stock (this is wonderfully convenient for small projects — just buy some samples at a big box store), so we’ll use that.

First, we load up our OpenSCAD program…

1 Like

Entering the parameters is complicated a bit by having to do the math to get from pocket dimension to box dimension (need to look into calculating and display those), but with a bit of effort we arrive at:

which seems pretty workable.


Until we try to load those settings into lualatex and we find out that the numbers when in metric exceed some limit…

a little bet of editing of the file and some conversion math and we arrive at:

1 Like

which with a bit of adjusting arrives at:


which loads into Carbide Create and allows us to set up appropriate toolpaths.

and with suitable toolpaths previews as:

(which isn’t quite right — needs to be in two separate files with suitable thicknesses, or have a pocket to thin the lid down to the right thickness — hang on)

Here, something like this:

cncboxfitted_2.375x3.5x0.5.c2d (224.3 KB)


Starting in on a web page on this at:

Fitted boxes are the easiest to make on a CNC — just two pocket cuts, one rabbet, and two profile cuts.

For a round box, the needed parameters may be as simple as:

  • diameter
  • thickness of the box bottom and lid
  • thickness of the wall of the box
  • width of the rabbet cut

Note that that last determines the size of the pocket of the lid, and should be adjusted by the tolerance needed to allow the lid to fit properly.

Designinto3d box fitted round 2x2 screen.png

The file for cutting this is simply a series of nested circles of appropriate dimensions:

Design into 3D box fitted round 2x2.svg

Given a 13.5mm thick stock, a 4.5mm thick bottom and lid, a 3mm tall lip, and using a 1/4" (6.35mm) endmill necessitating an 8mm or so offset geometry so as to cut the perimeter as a pocket rather than as a slot one would arrive at the following toolpaths:

Design into 3D box fitted round 2x2 cc toolpaths.png

which preview as:

Design into 3D box fitted round 2x2 cc preview.png

Carbide Create source: cncboxfitted_round_2x2.c2d (170.0 KB) — please adjust feeds and speeds as needed, as well as the rabbet for the lid as need be.


The wiki page has been updated with some photos and the Carbide Create source files for this posted to:


Reworked this in Blockscad3D:

(go to the editor, download the XML from: import it, and experiment)

Or, use the Customizer in OpenSCAD:

I’ll probably get it posted to Thingiverse presently, then will start in on the vectors (starting with lualatex and METAPOST) and then try to work up a TPL (Tool Path Language) file which will cut it out automatically.

If anyone has any thoughts or feedback I’d be grateful.


For the round box, adding a divider provides an interesting chance to create some visual interest, adding an “S” shape, rather than a simple line:

Unfortunately, that implementation does not properly preview the effect of cutting the design with a rounded endmill.

Adjusting the design for that requires that one work up the modeling for a tomoe/comma shape, which may then be sub-divided into a circle and an arbelos.


We start with a round box, 40mm in diameter:

It has a wall thickness of 6.35mm, and the lip/rabbet are 3.175mm in diameter, and we assume a 1/8" endmill will be used.

To get a reasonable curve, and placement of the resulting circles, we start and end one-half the diameter outside the inner area of the box:

Which results in a divider shape:

which describes two tomoe/comma shapes.

Removing a circle from one leaves an arbelos:

so we see that the two pockets of the box may be cut by removing two tomoe/comma shapes, which are each made up of a circle and an arbelos.

The arbelos is defined by 3 circles:

Okay, the basic rectangular generator is ready for testing:


and you’ll want the JSON to have a preset named “export”:

Then download:

(you’ll also need: )

If you run the .tex file it will make a PDF:

If you run the file it will make the SVGs:




Next is working up a way to indicate how deep each pocket is by mapping fill colour to a black tint.

Then we’ll work on automated toolpaths using TPL.

I’ll be presenting this at TUG2019:

and hope to have the preprint up presently.

1 Like

Once I have an end-to-end work-flow, I’ll see what can be done on the front-end — I’ve removed changing units from the OpenSCAD customizer since it was so clunky — I believe I can use OpenSCAD’s external editor support to use a custom front-end, either LiveCode or TCL/Tk (the latter is made more attractive by Drakon)

One the bright side, it seems as if documenting all this will look nice:

1 Like