chiark / gitweb /
maglite-holder: torch slop
[reprap-play.git] / maglite-holder.scad
1 // -*- C -*-
2
3 dxf_off = [ -40, -85 ];
4
5 torch_lit_dia = 37.5;
6 torch_big_dia = 56.5;
7 torch_tot_len = 256;
8 torch_big_len = 60;
9
10 torch_clear = 30;
11 torch_clear_below = 10;
12
13 stem_width = 20;
14 stem_thick = 8;
15
16 torch_recess = 14;
17 arm_width = 10;
18 block_thick = 15;
19
20 torch_out_more = 10;
21
22 brace = [ 40, 20, 20 ];
23
24 hole_dia = 4 + 0.5;
25 hole_slot = 5;
26
27 slop = 2; // total, not each side
28
29 $fa=5;
30
31 // calculated
32
33 above = torch_big_len + torch_clear + torch_clear_below;
34
35 holes = [ 172, 265 ];
36
37 stem_below = stem_width/2;
38
39 stem_len = holes[1] - above + stem_below;
40
41 torch_out = stem_thick + torch_big_dia/2 + torch_out_more;
42
43 block_width = arm_width*2 + torch_big_dia;
44
45 block_out = torch_out + torch_big_dia/2/sqrt(2);
46
47 module TorchOrig(){
48   mirror([0,0,1]){
49     hull(){
50       rotate_extrude()
51         translate(dxf_off)
52         import(file="maglite-holder-torch-curve.dxf",
53                convexity=10, center=true);
54     }
55     translate([0,0, -1])
56       cylinder(r=torch_lit_dia/2, h= torch_tot_len - torch_big_len + 1);
57   }
58 }
59
60 module Torch(){
61   scale(slop/torch_lit_dia + 1.0)
62     TorchOrig();
63 }
64
65 module ScrewHole(y, rot) {
66   translate([0,0, above -y]){
67     rotate([0,rot,0]){
68       hull(){
69         for (d= [-1,+1] * hole_slot/2) {
70           translate([d,0,0])
71             rotate([90,0,0])
72             translate([0,0,-stem_thick*2])
73             cylinder(r= hole_dia/2, h= stem_thick*4);
74         }
75       }
76     }
77   }
78 }    
79
80 module TorchMovement(){
81   // xxx needs torch increasing for slop
82   translate([0, -torch_out, 0]) {
83     translate([0, 0, -torch_recess])
84       Torch();
85     rotate([90,0,0])
86       linear_extrude(height= block_out)
87       projection() rotate([-90,0,0]) Torch();
88   }
89 }
90
91 module Bracket(){
92   difference(){
93     mirror([0,1,0]) {
94       translate([-stem_width/2, 0, -stem_len])
95         cube([stem_width, stem_thick, stem_len]);
96       translate([0,0, -block_thick]) hull(){
97         translate([-stem_width/2, 0, -brace[2]])
98           cube([stem_width, stem_thick, 1]);
99         translate([-brace[0]/2, 0, 0])
100           cube([brace[0], brace[1], 1]);
101       }
102     }
103     ScrewHole(holes[0], 90);
104     ScrewHole(holes[1], 0);
105   }
106   difference(){
107     mirror([0,1,0])
108       translate([-block_width/2, 0, -block_thick])
109       cube([block_width, block_out, block_thick]);
110     TorchMovement();
111   }
112 }
113
114 module Demo(){
115     %TorchOrig();
116   Bracket();
117 }
118
119 Demo();
120