
Building snap-fit 3D models is fun, but how, exactly, do you design them?
One way is to follow the lead of woodworkers, who have had the same challenge, and it’s long been solved. A popular approach is to use a dovetail, which is an interlocking set of cuts that fit together perfectly and firmly hold two parts.
How do you design a dovetail? That was the question facing Cal Bryant, who published a long post on how he was able to do this design using OpenSCAD.
OpenSCAD is a programming language for generating 3D models. Inherently parametric, it is ideal for creating parts that have specific dimensional requirements, like parts that have to fit together.
Bryant explained why the dovetail design is most useful:
“Dovetail joins are a traditional way to join wood together. They’re generally used for strength, but also aesthetics. They can be manually cut, or made using a handheld router (using a jig) or CNC router.
The strength comes from the tightening/wedging effect when pulling the join apart. If the dovetail is tapered, the join can also tighten when it aligns too – this is highly desirable for gluing, as it means the glue will not be scraped away.”
After discarding a number of older OpenSCAD attempts at creating dovetails, Bryant developed his own.
The result is a mere 68 lines of OpenSCAD code that can be used to generate proper dovetails. These can easily be incorporated into any OpenSCAD 3D model.
This makes it easily possible to develop larger objects in OpenSCAD by subdividing them into smaller components that are joined with dovetail joints.
If you’re into OpenSCAD, you might want to read Bryant’s lengthy explanation of dovetail generation.
Via Cal Bryant