From 3c9a59dcac7b940a4f8f9dcee55ac74116c87d3c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 20 Nov 2021 13:20:57 +0000 Subject: [PATCH] nutbox: transfer from other tree from a4d84a2286021d5a47c93edff24f2f0d5a863f19 Signed-off-by: Ian Jackson --- .gitignore | 1 + Makefile | 2 +- nutbox.scad.m4 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 nutbox.scad.m4 diff --git a/.gitignore b/.gitignore index 636889f..f328663 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ light-bracket.stl *.tmp *.fig.bak funcs.scad +nutbox.scad powerbank-anker-10000.dxf* knifeblock-knives-*.dxf* pandemic-counter-l*.dxf diff --git a/Makefile b/Makefile index 94cf025..35bfad0 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ QUACKS_SCADS = $(addsuffix .scad, $(QUACKSES)) USING_AUTOS ?= $(FILAMENTSPOOL_AUTOS) xeno-drivebay-bracket dungeonquest-cone anke-gps-bracket cable-hole-trunking-cover anglepoise-neck crossbar-computer-led-mount wardrobe-hook knifeblock pandemic-counter pattress-boxes-3-cover bike-lipo-box earring-stand bike-stalk-led-mount sewing-table sewing-table-test sewing-table-jig maglite-holder poster-tube-lid poster-tube-lid-coarse fairphone-case fairphone-battery-case lock-inframe-bracket ksafe-base $(QUACKSES) quacks-ingredients-demos mic-table-clamp nook-case nook-case-test scaffold-clamp-common.scad scaffold-clamp-tensioner scaffold-clamp-straphook powerbank-bike-clamp -AUTO_INCS += sealing-box.scad sewing-table.scad \ +AUTO_INCS += sealing-box.scad sewing-table.scad nutbox.scad \ powerbank-anker-10000.dxf \ poster-tube-lid-parametric.scad $(QUACKS_SCADS) diff --git a/nutbox.scad.m4 b/nutbox.scad.m4 new file mode 100644 index 0000000..5384eff --- /dev/null +++ b/nutbox.scad.m4 @@ -0,0 +1,65 @@ +// -*- C -*- +// edit nutbos.scad.m4, not nutbos.scad! +// shaft, nut_across, nut_thick, nut_recess, wall, ceil + +nutbox_data_M4 = [ + 4.0 + 0.5, + 6.89 + 0.45, + 3.10 + 0.75, + 0.75, + 2.0, + 2.5 + ]; + +nutbox_data_M3 = [ + 3.0 + 0.5, + 5.48 + 0.45, + 2.26 + 0.75, + 0.75, + 1.8, + 2.0 + ]; + +m4_define(shaft, (nutbox_data[0])) +m4_define(nut_across, (nutbox_data[1])) +m4_define(nut_thick, (nutbox_data[2])) +m4_define(nut_recess, (nutbox_data[3])) +m4_define(wall, (nutbox_data[4])) +m4_define(ceil, (nutbox_data[5])) + +m4_define(nut_dia, (nut_across / cos(30))) +m4_define(outer_size, (nut_dia + wall * 2)) +m4_define(h_base, (ceil + nut_thick + nut_recess)) + +function NutBox_shaft(nutbox_data) = shaft; +function NutBox_outer_size(nutbox_data) = outer_size; +function NutBox_h_base(nutbox_data) = h_base; +function NutBox_wall(nutbox_data) = wall; // not sure why anyone needs this + +module NutBox(nutbox_data, h, h_above_extra=0) { + // origin is centre of top of mount + // entrance is to positive y + // height is h which must be at least h_base + // can be mad extra tall (with hole all the way through) with h_above_extra + w = outer_size; + difference(){ + mirror([0,0,1]) translate([-w/2,-w/2, -h_above_extra]) + cube([w,w, h + h_above_extra]); + mirror([0,0,1]) translate([0,0,-1 -h_above_extra]) + cylinder(r = shaft/2, h = h+2 + h_above_extra, $fn=20); + for (offset = [ [0,0, -nut_recess], + [0, outer_size, 0] ]) { + hull(){ + for (toffset = [[0,0,0], offset]) { + translate(toffset) + translate([0,0, -ceil]) + mirror([0,0,1]) + rotate([0,0, 360/6/2]) + cylinder(r = nut_dia/2, + h = nut_thick, + $fn = 6); + } + } + } + } +} -- 2.30.2