Parametric 2 part Flex Boxes

It’s been a while since I posted anything because I’ve been busy making actual laser cutters but I just completed this OpenSCAD script to make 2 part parametric flex boxes. The scripts are hosted over at github so you can feel free to improve upon them and I intend to write an instructable this evening to describe how to use them for anyone who needs a few more pointers.


Hey! thats awesome. Im a huge fan of parametrically controlled designs. Thanks


Very nice. love the fact that they are parametric especially (and the living hinges rock).


These are great with just two parts to made a really nice box.


Cool design. I guess i need to learn OpenSCAD now. :slight_smile:


Don’t rush, it’s got some flaws that make it not really suitable for all things laser.
The biggest problem with most of these programs is that you can’t parametrically draw a line you can only draw a rectangle, it means double cutting most of the living hinge (or editing it out) and you can’t easily put two squares next to each other and common up the middle line.

There is definitely a gap for something specifically laser related.


Oh, wow. That is quite an omission!

It’s not really an omission, these tools are largely designed for 3D modelling work and certain things we want to do with the laser cutter don’t play well with that. It’s very difficult to work out how to join two shapes together when one of them isn’t ‘complete’ so they just don’t allow it, for anyone using it for 3D modelling this just isn’t a problem.


Nice alternative to a plain vanilla box… wait… this is a vanillabox… I mean a regular old box. Square and boxy-like without the living hinges.


As promised here is the instructable and now I must go to bed, crazy British time zones :slight_smile:


Fantastic! I love that we have boxes in two different online CAD packages.


OpenSCAD is fine for 2D design as well, but only for modelling real 2D objects. There is no such thing as a line in the real world, so you can’t model it in OpenSCAD. The actual living hinge has slots cut out of it the width of the kerf and with rounded ends. You can model that accurately in OpenSCAD.

The issue is that OpenSCAD models objects, not tool paths. To create the toolpath you need a CAM process that subtracts half the kerf. That will collapse the slot into a single line for the tool path. Glowforge is supposed to be able to do that but I wouldn’t hold my breath.


Question from an “uninitiated”. If you think in 3D terms, if you draw a “line” of where you want a cut to be, and then push it down to the thickness of your material, don’t you already have a (vertical) rectangle? It’s length is the length of your line, and the width is actually the height of the material.

Thinking of it that way would meant that you can absolutely create your living hinge design without any pieces “missing” from the programs point of view.

You can’t draw a 2D feature inside a 3D object in OpenSCAD. 2D objects all live on the flat Z = 0 plane.

There is no physical meaning to a vertical rectangle embedded on its edge in a 3D structure. OpenSCAD only models objects that can exist in real life.

The laser kerf is so small that the difference between a tool path and the end result are often ignored in the laser world and people draw tool paths in 2D art programs and miss out the CAM stage. I come from the world of 3D printing and 2D / 3D milling where there is a clear distinction between the model and the tool path that creates it and separate CAD and CAM programs.

1 Like

so, what if you were to add a “height” to that vertical rectangle equal to the width of the kerf? That would turn it into a normal 3D box instead of a 2D rectangle.

(Not trying to be difficult, just trying to understand and learn)

1 Like

I would love an OpenSCAD_LASER version. I model the objects in 3D for fit and then have to lay them all flat before creating an export for Inkscape so I can add any artwork. Not exactly ideal, but I think it’s working for me. Only one way to know, but I haven’t received that email.

1 Like

Yes you can model the slot in 3D by subtracting a thin box. You would then need to project the 3D object onto a 2D plane to get an SVG file for laser cutting.

If you want to model the assembled box in 3D you can either define the faces as 2D objects and extrude them to make 3D walls or you can define the walls in 3D and project them to get 2D faces.

You can never get a line with no width in OpenSCAD though, just as you can’t make anything with no width.


You could have a script that post-processed the SVG, but I don’t know just how ugly it would be. I’ve done some script-based stuff on openscad SVGs, but not for this purpose.

1 Like

This script is so helpful in many ways. Thanks a bunch. The resulting SVG is certainly usable as is in the Glowforge. Interesting how it does the cuts in the hinge, as you mentioned. This is a screen grab of the hinge in outline mode.


Yes I could write a CAM program that takes an SVG description of the object from OpenSCAD and produces and SVG of the tool path by subtracting kerf and eliminating double cuts. I expect Glowforge to do that but if I ever get one and it doesn’t do it I will have to write one. I will also have to write a CAM program to take 3D STLs and turn them into depth map PNGs and SVG outlines as Dan has said Glowforge will not do that.

This is because I model everything I make in OpenSCAD and it can’t model vector tool paths or produce depth maps because it is CAD, not CAM.