Making Box/Cubes Parametric

I hope to show how it works.

(with apologies to Mark Knopfler)

I believe I’ve worked through all the possible difficulties and complications of this sort of thing, and have a handle on an optimal solution/representation which will handle design and parameterization, features/options, layout and arrangement and export for cutting and so forth.

It would be nice if there were some better tool/technique which suited me, but perfect is the enemy of good enough and I have some 139 pages which will need to be revised based on this.

As per usual, we start in BlockSCAD with the basics of dimension parameters and units:

Since we need to represent things as parts, we need one further dimension for Part Spacing and another for Stock Thickness, and we will need modules for each part:

One consideration here is labeling the parts — fortunately, Open/BlockSCAD support text, so:

With a few additional variables we arrive at a fully labeled set of parts:

Add a 3D preview option for better visualization:

Next we need some logic for the joinery and whether the top is included or no:

With that in place, and the V carving trimmed back a bit, we need to work out the fingers/pins — there will be 3 separate pin widths:

  • vertical (for the sides going up the corners of the box)
  • horizontal (side–side along the bottom/top of the box)
  • depth-wise (front–back along the bottom/top of the box)

Due to the vagaries of how OpenSCAD handles variables, the most expedient thing is to allow defining the number of pins for each set of edges.

which will then require calculating the necessary width of each:

Using a single module for the joinery requires a number of variables: