Design into 3D

From ShapeOko
Jump to: navigation, search

Design into 3D is an effort to create a systematic set of project generators for CNC projects, documenting things well enough that one would be able to draw up traditional plans using pen and pencil and fabricate an instance of a project using hand tools.

It is simultaneously:

  • an opensource project which is a collection of projects for things such as boxes, furniture, and tools
  • a Kickstarter
  • a book (currently in early draft stages)
  • a paper submitted to the TeX User's Group 40th Anniversary 2019 conference
    • Design into 3D is a system for modeling parametric projects for manufacture using CNC machines. It documents using OpenSCAD to allow a user to instantly see a 3D rendering of the result of adjusting a parameter in the Customizer interface, parameters are then saved as JSON files which are then read into a LuaLaTeX file which creates a PDF as a cut list/setup sheet/assembly instructions and METAPOST to create SVG files which may be loaded into a CAM tool. A further possibility is using a tool such as TPL (Tool Path Language) to make files which are ready to cut.
  • a website:
  • a design philosophy

The design philosophy touches on the idea that fundamentally there are only two types of furniture:

  • platforms
  • boxes

with more complicated pieces incorporating both structures.

Currently it uses OpenSCAD as a 3D modeling front-end using the customizer feature which is available in current versions.[1] When the parameters for a suitable design are entered into the customizer they may be saved as a preset in a JSON file which is stored in the same directory as the OpenSCAD source file. These may then be loaded into a file which generates a design for cutting, or toolpaths. Prospects for this include Tool Path Language and METAPOST using the library embedded in LuaTeX and importing the JSON file using the Lua scripting language.


When launched, OpenSCAD will display a blank window with an Editor, Console, and Customizer:

Design into 3D OpenSCAD interface launch.png

Hide the Editor, Console, and disclose the areas of the Customizer and use the Preview area's interface controls (esp. the 3rd button from the left to View All) to display the project and the parameters which may be adjusted:

Design into 3D OpenSCAD interface customizer.png

Clicking the + button in the preset area will allow one to name a preset and save the settings for the current design under that name. Presets will be saved as JSON files:

    "parameterSets": {
        "export": {
            "$fn": "45",
            "Boxshape": "rounded",
            "Clearance": "0.01",
            "Height": "13.5",
            "Length": "66.675",
            "PARTNO": "0",
            "Thickness": "6.35",
            "Width": "209.55",
            "depth": "25.4",
            "diameter": "3.175",
            "dividers_lengthwise": "1",
            "dividers_thickness": "3.175",
            "dividers_widthwise": "2",
            "endmillshape": "ball",
            "largecompartment": "widthwise",
            "partspacing": "12.7"
    "fileFormatVersion": "1"

which may then be used for further processing. In this case, the preset is named "export".

Geometry and Toolpaths

Once one has a saved preset in a JSON file from OpenSCAD, then it is a matter of generating the geometry and toolpaths which will be needed to cut out the project.


Loading files from JSON is well documented in most programming tools with free/opensource code readily available:

Two are notable for being suited to making geometry and/or toolpaths:

For other options see: Programmatic G-Code Generators

One intersection of those is lualatex which includes a Lua interpreter for scripting, and a METAPOST library for vector graphics.

One can use Lua to read in the values from the JSON file and assign them to macros (in LaTeX) and variables (in Lua) which will allow one to make use of the values in METAPOST.

For example, in LaTeX, one defines a macro for each value which may then be redefined at need:

%            "PARTNO": "0",

Note that it will be necessary to rename variables so as to avoid LaTeX special characters (such as underscores) or LaTeX command structures (such as \end...).

One then reads in each variable from the selected preset (assigned to the LaTeX macro \boxspecification):

PARTNO = (table['parameterSets']['\boxspecification']['PARTNO'])

and defines the contents of the matching TeX macro:



The challenge here is the differences in how the modeling is done in each tool:

  • OpenSCAD defines volumes and the removing of material from an area using Boolean operations for difference and intersection
  • Tool Path Language defines a toolpath for a tool resulting in the removal of material based on that tool diameter/shape moving through the material
  • METAPOST defines geometric regions without an offset

Defining a series of macros and functions which allow each tool to work in a similar fashion would simplify these calculations tremendously.

Possible approaches:

  • import SVG into OpenSCAD
  • work up OpenSCAD macro which allows the use of METAPOST syntax


First though, one must define the geometry of the design. This is done using classic geometric constructs, and possibly some curves defined by fancy math (but usually drawn up in a CAD or Bézier curve drawing program.


The most basic construct is a point in coordinate space --- some CAM tools allow one to assign a drilling operation at a point.


Straight lines are the fundamental building blocks of vector drawing and are of course defined as the shortest distance between two points. Some CAM tools will allow one to assign various toolpaths to lines, and if not directly on the line, the offset will be determined by which point is the origin and which is the final point.


Many CAD programs will allow the definition of arcs which are easily drawn and may be specified in several ways --- an origin point, end point, and a point of rotation are typical.


Curves are omitted from some tools, and when present may be defined in several ways.

Bézier Curves

The most common is Bézier curves which are defined by an on-curve point (the origin), a matching off-curve point, and an additional off-curve point paired with the ending on-curve point.


Paths are made up of multiple points, and/or lines/arcs/curves and are differentiated by being open or closed.

Open Paths

As noted above, toolpaths may be assigned to open paths, and the directionality will determine any offset. Open paths are necessarily limited in the toolpaths which may be assigned, and it will typically not be possible to assign any but the most basic of operations to them.

Closed Paths

Closed paths meet back at the point of origin and open up additional operations in CAM tools. They may be made up of lines, arcs, curves, or some combination.

Often tools will have especial support for regular polygons, allowing their creation or definition quickly and efficiently.

Third Dimensional Shapes

Extending all of these into 3 dimensions becomes more complex with each additional element, each of which complicates the mathematics.

Up through arcs and regular curves, these are usually manageable, as is expressed in constructive solid geometry (CSG), and OpenSCAD is essentially a scripting front-end for this.

Extending arbitrary curves into 3 dimensional space involves complex geometric calculations which are the domain of 3 dimensional modeling tools such as Blender and various commercial programs.

Fortunately, the regular polygons and extruded shapes of CSG afford one a very wide array of design options.


Once one has multiple three dimensional shapes, one must consider their interactions and connections.


Creating toolpaths is just that, modeling the motion of the rotary tool through 3 dimensional space.

These toolpaths necessarily partake of the roundness of the tool, and are limited by that in terms of 3D space, so circles are easy, while sharp-cornered triangles and squares are not possible. One possible strategy here is to model the possible 2-dimensional shapes which one might have occasion to cut out:

  • circles
  • ovals
  • arcs of circles
  • triangles with rounded corners
  • square/rectangles with rounded corners

Geometric shapes

With a library of such geometry, one should be able to cut out the majority of designs which are typically done using 2.5D CAM.

One possible organization method would be to characterize them by number of points and whether or no they can be determined by only arcs/straight lines:

  • 0
  • 1
    • cone with rounded end (arc) --- also see "sector" under 3 below
  • 2
    • semicircle/circular/half-circle segment (arc and a straight line) see also sector below
    • arch --- curve possibly smoothly joining a pair of straight lines with a flat bottom
    • lens/vesica piscis (two convex curves)
    • lune/crescent (one convex, one concave curve)
    • heart (two curves)
    • tomoe (comma shape) --- requires non arc curves
  • 3
    • triangle
      • equilateral
      • isosceles
      • right triangle
      • scalene
    • (circular) sector (two straight edges, one convex arc)
      • quadrant (90°)
      • sextants (60°)
      • octants (45°)
    • Deltoid curve (three concave arcs)
    • Reuleaux triangle (three convex arcs)
    • Arbelos (one convex, two concave arcs)
    • two straight edges, one concave arc --- "dart" was suggested by Dr. Donald Knuth at the TUG2019 conference.[2]
    • two convex, one concave arc --- with the above named, "arrowhead" is freed up to use for this.
  • 4
    • rectangle
      • square
    • parallelogram
    • rhombus
    • trapezoid/trapezium
    • kite
    • ring/annulus segment (straight line, concave arc, straight line, convex arc)
    • asteroid (four concave arcs)
    • salinon (four semicircles)
    • three straight lines and one concave arc

Resources and Research

There are a number of other parametric tools for CNC using a variety of technologies. Each is a reflection of the capabilities and limitations of the tools used. They may be roughly divided into three categories:

Parametric CAD tools

Unfortunately, the complexities of parametric design make these tools rather difficult to use for the typical user:

  • Commercial
    • Autodesk Fusion 360/Inventor
    • CATIA V5
    • NX
    • Onshape
    • Pro Engineer
    • Rhino 3D (when using the Grasshopper plug-in)
    • Solid Edge
    • SolidWorks
  • Opensource (graphical)
    • FreeCAD
    • NaroCAD
    • OpenVSP (Vehicle Sketch Pad from NASA)
    • SolveSpace
    • Varkon

This is by no means an exhaustive list, see CAD and Commercial Software for further examples.

General purpose parametric design/programming tools

Here, we concern ourselves only with tools which are explicitly intended to create designs in CAD formats, or projects ready for CNC production:

Special purpose parametric design tools

Unsurprisingly, There are a number of parametric design tools for specific usages:

A number of projects have been begun, and then vanished, for instance "Mattermachine", or been begun and then abandoned such as the developer of which is working at:

Current Status

Projects which have been completed and additional ones which may be worked up:

Kickstarter Reward Survey

  • Box
  • Stool
    • Folding step stool
      • 18x18x18
    • Stool (fits together with slotted joints)
  • Chair Cup Holder
    • (no project dimensions provided, should fit on 1200mm x 1500mm work area)
  • Acrylic LED plaque on wooden base
    • 6 inches
  • Scalable drawer dividers/separators
    • 12" x 24"
    • 10" x 10" x 4"
    • sized for spice drawers
  • collectible card game sorting tray
  • Kitchen nook table and chairs
    • 5' x 5'
  • Topographic map
    • 8" x 8"
  • parametric French curve template
    • 5x5x5
  • Musical Instrument: 3 string guitar
    • Ukulele size
  • mortise and tenons
    • 1/2" x 1"
    • fit XXL
  • Sandpaper storage rack
    • small enough to cut on XXL
  • light switch cover
    • standard
  • 3D model --- coin bank project (coin image on each side)
    • 6.5" x 3.5"
  • Baby Name Blocks
    • parametric
  • Customizable cribbage boards
    • metric and Imperial
    • Oval cribbage board for 4/6 players with space for optional central motif/message 300mm x 150mm
  • Beer tap handles
  • something
    • 14" x 14"
    • 33" x 33"
    • parametric abstract design
      • 15" x 15"

Implemented Kickstarter Designs


The project is being worked on at: and has received a 6 month extension and should be finished before June 2021.

Programming Notes

Use translation to make OpenSCAD coordinates match those of TPL.

Spot all four corners with rapid movements in OpenSCAD.

Work up identical macros for all programs in question starting with OpenSCAD, TPL, and METAPOST.