Initial commit

This commit is contained in:
mmcwilliams 2025-03-25 16:48:27 -04:00
commit 6cb3558ad5
7 changed files with 63876 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "scad/common"]
path = scad/common
url = https://git.sixteenmillimeter.com/modules/common.git

15
README.md Normal file
View File

@ -0,0 +1,15 @@
# Knobs
This repo contains a parametric knob generator for quickly generating tactile knobs for standard metric bolts.
## Example
```scad
use <./scad/knob.scad>;
knob(H = 10, D = 14, DEPTH = 4, BOLT = "M4", TYPE = "hex");
```
This will generate a knob that is 10mm high, has a diameter of 14m and takes an M4 hex bolt that sits 4mm from the bottom.
An M4 bolt can be dropped in, or an M4 nut.

BIN
img/knob_m4_hex_10h_14d.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

3
scad.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
bash ./scad/common/scad.sh ./scad/knob.scad

1
scad/common Submodule

@ -0,0 +1 @@
Subproject commit e2eeb27f173d739a174c0d147bcb62a16859e2d9

68
scad/knob.scad Normal file
View File

@ -0,0 +1,68 @@
use <./common/common.scad>
use <./common/Triangles.scad>;
module knob (H = 12, D = 24, DEPTH = 4, BOLT = "M4", TYPE = "hex") {
NOTCH = 1;
N = ceil(D * 3.14 / 1.5);
BOT = 12;
BOT_H = 2;
THICKNESS = 4.25;
ID = D - THICKNESS;
supported = true;
echo(N);
difference() {
union () {
cylinder(r = D / 2, h = H, center = true, $fn = 360);
translate([0, 0, -(H / 2) - (BOT_H / 2)]) {
cylinder(r = BOT / 2, h = 2, center = true, $fn = 360);
}
}
if (BOLT == "M3") {
cylinder(r = 3.1 / 2, h = H * 2, center = true, $fn = 60);
} else if (BOLT == "M4") {
cylinder(r = 4.25 / 2, h = H * 2, center = true, $fn = 60);
} else if (BOLT == "M5") {
cylinder(r = 5.1 / 2, h = H * 2, center = true, $fn = 60);
} else {
supported = false;
}
assert(supported, "Bolt size not supported!");
//hollow inner cylinder
translate([0, 0, DEPTH]) cylinder(r = ID / 2, h = H, center = true, $fn = 360);
if (BOLT == "M4" && TYPE == "hex") {
translate([0, 0, -(H / 2) + DEPTH - 1.4]) m4_nut();
} else if (BOLT == "M5" && TYPE == "hex" ) {
translate([0, 0, -(H / 2) + DEPTH - 1.4]) m5_nut();
} else if (BOLT == "M5" && TYPE == "socket") {
translate([0, 0, -(H / 2) + DEPTH - 1.4]) m5_bolt();
}
//grips
for(i = [0 : N]) {
rotate([0, 0, i * (360 / N)]) {
translate([D / 2.87, D / 2.87, 0]) {
Right_Angled_Triangle(a = NOTCH, b = NOTCH, height = 22, centerXYZ=[true, true, true]);
}
}
}
//taper top
translate([0, 0, H / 2 - 0.7]) difference () {
cylinder(r = D / 2 + 2, h = 2, center = true, $fn = 360);
cylinder(r1 = D / 2 + 1, r2 = D / 2 - 1, h = 2.01, center = true, $fn = 360);
}
//taper bottom
translate([0, 0, -H / 2 + 0.7]) difference () {
cylinder(r = D / 2 + 2, h = 2, center = true, $fn = 360);
cylinder(r2 = D / 2 + 1, r1 = D / 2 - 1, h = 2.01, center = true, $fn = 360);
}
}
}
PART = "m4_hex_10h_14d";
if (PART == "m4_hex_10h_14d") {
knob(H = 10, D = 14, DEPTH = 4, BOLT = "M4", TYPE = "hex");
}

63786
stl/knob_m4_hex_10h_14d.stl Normal file

File diff suppressed because it is too large Load Diff