2 // edit nutbos.scad.m4, not nutbos.scad!
3 // shaft, nut_across, nut_thick, nut_recess, wall, ceil
23 m4_define(shaft, (nutbox_data[0]))
24 m4_define(nut_across, (nutbox_data[1]))
25 m4_define(nut_thick, (nutbox_data[2]))
26 m4_define(nut_recess, (nutbox_data[3]))
27 m4_define(wall, (nutbox_data[4]))
28 m4_define(ceil, (nutbox_data[5]))
30 m4_define(nut_dia, (nut_across / cos(30)))
31 m4_define(outer_size, (nut_dia + wall * 2))
32 m4_define(h_base, (ceil + nut_thick + nut_recess))
34 function NutBox_shaft(nutbox_data) = shaft;
35 function NutBox_outer_size(nutbox_data) = outer_size;
36 function NutBox_h_base(nutbox_data) = h_base;
37 function NutBox_wall(nutbox_data) = wall; // not sure why anyone needs this
39 module NutBox(nutbox_data, h, h_above_extra=0) {
40 // origin is centre of top of mount
41 // entrance is to positive y
42 // height is h which must be at least h_base
43 // can be mad extra tall (with hole all the way through) with h_above_extra
46 mirror([0,0,1]) translate([-w/2,-w/2, -h_above_extra])
47 cube([w,w, h + h_above_extra]);
48 mirror([0,0,1]) translate([0,0,-1 -h_above_extra])
49 cylinder(r = shaft/2, h = h+2 + h_above_extra, $fn=20);
50 for (offset = [ [0,0, -nut_recess],
51 [0, outer_size, 0] ]) {
53 for (toffset = [[0,0,0], offset]) {
55 translate([0,0, -ceil])
57 rotate([0,0, 360/6/2])
58 cylinder(r = nut_dia/2,