]> www.fi.muni.cz Git - things.git/blob - hydrofoam-motor-holder.scad
switch holder.scad
[things.git] / hydrofoam-motor-holder.scad
1 eps = 0.01;
2 infty = 300;
3
4 stem_len = 90;
5 stem_d = 12;
6 stem_d2 = 2;
7 stem_x = 12;
8
9 stem_hole_w = 4;
10 stem_hole_h = 12;
11
12 module stem_profile() {
13 difference() {
14         translate([0, 0, stem_d/2])
15                 hull() {
16                 rotate([0, 90, 0])
17                         scale([1.5, 1, 1])
18                         cylinder(r = stem_d/2, h = stem_len, $fn = 64);
19                 rotate([0, 90, 0])
20                 translate([-stem_x-stem_d2/2, 0, 0])
21                         cylinder(r = stem_d2/2, h = stem_len, $fn = 16);
22         }
23         translate([-infty/2, -infty/2, -infty]) cube(infty);
24         translate([-eps, -stem_hole_w/2, -eps])
25                 cube([stem_len + 2*eps, stem_hole_w, stem_hole_h + 2*eps]);
26 }
27 }
28
29 motor_d = 28; // unused here, just for reference
30 motor_screw_dist = 12.5;
31 motor_screw_d = 3 + 0.5;
32 motor_screw_head = 5 + 0.5;
33 motor_center_hole = 8 + 2;
34 motor_wall = 2.5;
35 motor_plate_h = 2.5; // base thickness of the motor mount
36
37 module motor_mount_body() {
38         // make it symmetrical in both axes
39         for (x = [-1,1]) scale([x, 1, 1])
40         for (y = [-1,1]) scale([1, y, 1]) {
41                 hull() { // bottom plate with motor mount
42                         cylinder(r = motor_center_hole/2 + motor_wall,
43                                 h = motor_plate_h);
44                         translate([motor_screw_dist/2, motor_screw_dist/2, 0])
45                                 cylinder(r = motor_screw_d/2 + motor_wall,
46                                         h = motor_plate_h);
47                 }
48         }
49 }
50
51 module motor_mount_square() {
52         translate([-motor_screw_dist/2-motor_screw_d/2-motor_wall,
53                 -motor_screw_dist/2-motor_screw_d/2-motor_wall, 0])
54                 cube([motor_screw_dist + motor_screw_d + 2*motor_wall,
55                         motor_screw_dist + motor_screw_d + 2*motor_wall,
56                         motor_plate_h]);
57 }
58
59 screw_hole_h = 20;
60 module motor_mount_holes() {
61         // center hole
62         translate([0, 0, -eps])
63                 cylinder(r = motor_center_hole/2, h = 2*motor_plate_h + 2*eps);
64         // make it symmetrical in both axes
65         for (x = [-1,1]) scale([x, 1, 1])
66         for (y = [-1,1]) scale([1, y, 1]) {
67                 // screw hole
68                 translate([motor_screw_dist/2, motor_screw_dist/2, -eps])
69                         cylinder(r = motor_screw_d/2, h = screw_hole_h+eps);
70                 // screw head cone
71                 translate([motor_screw_dist/2, motor_screw_dist/2, motor_plate_h - (motor_screw_head - motor_screw_d)/2])
72                         cylinder(r1 = motor_screw_d/2, r2 = motor_screw_head/2, h = (motor_screw_head - motor_screw_d)/2 + eps);
73                 // screw top (for subtracting from other objects
74                 translate([motor_screw_dist/2, motor_screw_dist/2, motor_plate_h])
75                         cylinder(r = motor_screw_head/2, h = screw_hole_h - motor_plate_h);
76         }
77         // cut the bottom
78         translate([-infty/2, -infty/2, -infty]) cube(infty);
79 }
80
81 mount_angle = -110;
82
83 difference() {
84         union() {
85                 stem_profile();
86                 translate([stem_len, 0, 0])
87                 rotate([0, mount_angle, 0])
88                 translate([motor_screw_dist/2 + motor_screw_d/2 + motor_wall, 0, 0])
89                         motor_mount_square();
90         }
91         translate([stem_len, 0, 0])
92         rotate([0, mount_angle, 0])
93                 translate([motor_screw_dist/2 + motor_screw_d/2 + motor_wall, 0, 0])
94                 rotate([0, 0, 90]) // rotate the hexagons
95                 motor_mount_holes($fn = 6);
96         // cut the bottom of the rotated motor plate
97         translate([-infty/2, -infty/2, -infty]) cube(infty);
98         // angled rear end
99         rotate([0, 45, 0])
100         translate([-infty, -infty/2, -infty/2]) cube(infty);
101 }