OpenSCAD parametric hook

Parametric design of a simple hook in, the free and open source, OpenSCAD. Use with the Customizer in OpenSCAD

Writing a script for a simple hook in OpenSCAD is easy but I wanted to do something more and make a parametric hook. With parametric I mean that a user can easily adjust the script by changing some variables to make your own hook.

To make it even easier the script makes use of the Customizer of OpenSCAD. This means that users don’t have to tinker with the code but can adjust the values of the variables with a easy to use panel on the right side of the GUI of OpenSCAD called the Customizer. (If you don’t see the Customizer in OpenSCAD go to the menu bar and click on Windows and then Customizer).

Screenshot of the script with the Customizer on the right side.
Smaller hook with chamfer
Larger hook with fillet

Aside from changing the dimensions I also added the possibility to add a fillet or a chamfer to the hook. And I added the option to change the radius of the hook and the diameter of the screw holes.

If you’re interested here is an explanation of some parts of the code. The fillet of the cube shaped parts of the hook is created with the fillet module. Within this module I simply intersect a cylinder with radius r1 and a cube of the desired length l.

module fillet(l,r1) {
    intersection() {
        cube([l,l,l]);
        cylinder(h=l, r=r1, $fn=50);
    }
}

In the module roundedCube the thus created fillet pieces are positioned in a such a way that the hull command shapes them to the desired filleted cube.

module roundedCube(l,w,h,r1) {
    d = 2 * r1;
    translate([r1,r1,0])
    hull() {
        rotate([0,0,180]) fillet(l,r1);
        translate([0,w-d,0]) rotate([0,0,90]) fillet(l,r1);
        translate([h-d,0,0]) rotate([0,0,270]) fillet(l,r1);
        translate([h-d,w-d,0]) rotate([0,0,0]) fillet(l,r1);
    }
}

I published the OpenSCAD script (.scad) and some example hooks (.stl) on Prusaprinters. You can download it here:

https://www.printables.com/model/91734-parametric-hook-with-source-file

EDIT: V1.1 of the OpenSCAD file (.scad) has the option to add a countersunk to the screw holes.

Leave a Reply