Welcome back to The GigMan’s Life.
Today we’re starting something I probably should’ve done years ago.
We’re building an OpenSCAD library.
And we’re starting with fasteners.
Because before you get too excited about designing your next enclosure, bracket, or whatever strange thing you’ve decided to print, there’s one question you should probably answer.
How are you going to hold this shit together?
Most likely, screws and bolts.
Now, I’ve been guilty of designing the same damn mounting holes and cutouts repeatedly. And considering I learned mechanical drawing back in high school, I really should know better.
So we’re going to do something about that.
First, understand your fastener
We’re going to create four different types of cutouts.
- A straight clearance hole for a screw or bolt.
- A countersink for a flat-head screw.
- A counterbore for a screw head that needs a cylindrical recess.
- A hexagonal pocket for retaining a nut.
The important thing is that these are not four completely separate projects.
They’re four options inside one reusable module.
Second, understand your center
We’re going to work from the center of the fastener.
Why?
Because once you know where the center of your fastener belongs, you can position the entire cutout using that one location.
You don’t need to independently position the shaft hole and the screw-head recess.
They’re already aligned.
That’s the beauty of getting your mathematics right in the first place.
Third, let OpenSCAD do the cutting
We’re going to use difference().
We create the material we want to keep, and then subtract the fastener geometry from it.
And here’s the entertaining part.
We’re not actually modeling a screw to print.
We’re modeling the space that screw needs.
Because a screw that looks perfect on your screen isn’t worth a damn if it doesn’t fit in the printed part.
Fourth, build your library
We’re saving the reusable fastener module in a separate file called fasteners.scad.
Then we’re going to reference that file from another project.
And that’s where the real benefit begins.
You don’t have to keep copying the same code into every design.
Build it once. Save it. Reference it. Reuse it.
And as you learn more, add more fasteners to your library.
Finally, print something and test it
Don’t assume that a 3.4 mm hole printed on your machine is going to measure exactly 3.4 mm.
Print a small test piece.
Try your screws.
Check your countersinks and nut pockets.
Adjust the dimensions until they work with your actual printer and hardware.
Because there’s nothing quite like finding out that a 12-hour print doesn’t fit together.
And yes, I’ve learned that lesson too.
So that’s today’s project. Nothing complicated. Just one of the most important things you’ll use in 3D design.
How to hold the damn thing together.
It’s a Gig Man’s Life indeed.
Get the OpenSCAD Tutorial Files
The files for A Coding We Will Go — Lesson 01: Fasteners 101 are available on Thingiverse.
Download the Fasteners 101 Project Files on Thingiverse
These files accompany the tutorial and provide the starting point for building your own reusable OpenSCAD fastener library.
Download the project, open the OpenSCAD files, and follow along as we explore the Customizer, fastener dimensions, countersinks, counterbores, and reusable modules.
The goal isn’t just to make a screw hole. It’s to learn how to create something you can reuse in future designs.
Build it once. Save it. Reference it. Reuse it.
