OpenSCAD - BASICS - Make-a-Module Keyhole mount opening @mathcodeprint
OpenSCAD - BASICS - Make-a-Module Keyhole mount opening  @mathcodeprint
Uploaded May 2017 | Updated November 2026, 3 hours ago
This is a module I thought might be useful to keep in a library, possibly not, it was rewarding doing it anyway. It is very basic stuff here. Don't bother if you have experience. You have been warned.

Here is a step by step with time index. ( I got out of sync around step 10. )

STEP1.) 00:53 Create the Module and add Variables

module keyhole_mount( thickness ){
SCREW_DIAMETER = 3; // The shaft of the bolt
SCREW_HEAD_DIAMETER = 6; // The head of the bolt
}

STEP 2.) 01:38 Add a call to the module so we can render as we go.

keyhole_mount( 2 );

STEP 3.) 02:01 Add 2 - 2D Circles and a hull for the basic cutout.

circle(SCREW_DIAMETER/2, center=true);
circle(SCREW_DIAMETER/2, center=true);

STEP 4.) 02:56 Translate the second circle using the screw head diameter as the distance

translate([SCREW_HEAD_DIAMETER,0])

STEP 5.) 02:56 Create a hull() of the two circles
hull(){
circle(SCREW_DIAMETER/2);
translate([SCREW_HEAD_DIAMETER,0]) circle(SCREW_DIAMETER/2, center=true);
}

STEP 6.) 03:42 Add a third circle for the screw head to fit through.

circle(SCREW_HEAD_DIAMETER/2);

STEP 7.) 04:20 Translate the third circle using the screw head diameter as the distance

translate([SCREW_HEAD_DIAMETER,0])

STEP 8.) 04:40 Add thickness using linear_extrude and the thickness arguement, we use the full thickness to avoid overlaping faces.

linear_extrude( thickness ) {
}

STEP 9.) 05:23 translate this object in the negative Z direcection so the bottom face does not overlap with the cutout's bottom face.

LABEL THIS SECTION AS THE Keyhole Cutout

BELOW THE KEYHOLE CUTOUT add code for the DETENT

LABEL THIS SECTION THE DETENT

STEP 10. ) 06:00 Copy the hull() portion in STEP 5 and change SCREW_DIAMETER to SCREW_HEAD_DIAMETER

hull(){
circle( SCREW_HEAD_DIAMETER/2 + SCREW_HEAD_DIAMETER/8 );
translate([SCREW_HEAD_DIAMETER,0]) circle( SCREW_HEAD_DIAMETER/2 + SCREW_HEAD_DIAMETER/8);
}

STEP 11. ) Add thickness to the detent using the thickness arguement. Use the full thickness to ensure it is properly subtracted later in the model.

linear_extrude( thickness/2 ) {
}

STEP 12.) 06:45 Translate the detent in the positive Z direction half the amount of thickness.

translate( [0,0,thickness/2] ){

STEP 13.) 08:10 Make a union() out of these shapes

STEP 14. ) 08:20 Create a test shape to cutout a keyhole

STEP 15.) Position the shape with translate

STEP 16.) 09:30 make multiple copies with linear_array module()
OpenSCAD - BASICS - Make-a-Module Keyhole mount openingFreeCAD - Use Assembly2 Workbench for Virtual Test Fit B4 3D PrintingFreeCAD Export to KiCADFreeCAD Tutorial - Centering Text on a Surface.FreeCAD - Design and Print an Arduino Case - Slotted LidFreeCAD Tutorial - Use the Draft workbench Rotate ToolTinkerCAD - Getting Started, Guest TutorialOpenSCAD 2019 New Features, Customizer and Code Hints.Kicad 6 Quick Tip, asigning Footprints - Tip for us noobsFreeCAD - Screen Cap for Draft PathArray BugFreeCAD - Working session with my Sketcher Shapes Workbench.FreeCAD - Basics - Using Sketcher Workbench Drawing Tools
mathcodeprint |

OpenSCAD - BASICS - Make-a-Module Keyhole mount opening

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER