chiark / gitweb /
9804fb020085a469a2daf23f3f2030b15b867de7
[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, 10, 20 ];
23
24 $fa=5;
25
26 // calculated
27
28 above = torch_big_len + torch_clear + torch_clear_below;
29
30 holes = [ 172, 265 ];
31
32 stem_below = stem_width/2;
33
34 stem_len = holes[1] - above + stem_below;
35
36 torch_out = stem_thick + torch_big_dia/2 + torch_out_more;
37
38 block_width = arm_width*2 + torch_big_dia;
39
40 block_out = torch_out + torch_big_dia/2/sqrt(2);
41
42 module Torch(){
43   mirror([0,0,1]){
44     hull(){
45       rotate_extrude()
46         translate(dxf_off)
47         import(file="maglite-holder-torch-curve.dxf",
48                convexity=10, center=true);
49     }
50     translate([0,0, -1])
51       cylinder(r=torch_lit_dia/2, h= torch_tot_len - torch_big_len + 1);
52   }
53 }
54
55 module TorchMovement(){
56   translate([0, -torch_out, 0]) {
57     translate([0, 0, -torch_recess])
58       Torch();
59     rotate([90,0,0])
60       linear_extrude(height= block_out)
61       projection() rotate([-90,0,0]) Torch();
62   }
63 }
64
65 module Bracket(){
66   difference(){
67     mirror([0,1,0]) {
68       translate([-stem_width/2, 0, -stem_len])
69         cube([stem_width, stem_thick, stem_len]);
70       translate([0,0, -block_thick]) hull(){
71         translate([-stem_width/2, 0, -brace[2]])
72           cube([stem_width, stem_thick, 1]);
73         translate([-brace[0]/2, 0, 0])
74           cube([brace[0], brace[1], 1]);
75       }
76     }
77   }
78   difference(){
79     mirror([0,1,0])
80       translate([-block_width/2, 0, -block_thick])
81       cube([block_width, block_out, block_thick]);
82     TorchMovement();
83   }
84 }
85
86 module Demo(){
87   translate([0, -torch_out, 0])
88     %Torch();
89   Bracket();
90 }
91
92 Demo();
93