chiark / gitweb /
f661c1c2a233ee000e2a482fd500a2fb8288b7fd
[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   // xxx needs torch increasing for slop
57   translate([0, -torch_out, 0]) {
58     translate([0, 0, -torch_recess])
59       Torch();
60     rotate([90,0,0])
61       linear_extrude(height= block_out)
62       projection() rotate([-90,0,0]) Torch();
63   }
64 }
65
66 module Bracket(){
67   difference(){
68     mirror([0,1,0]) {
69       translate([-stem_width/2, 0, -stem_len])
70         cube([stem_width, stem_thick, stem_len]);
71       translate([0,0, -block_thick]) hull(){
72         translate([-stem_width/2, 0, -brace[2]])
73           cube([stem_width, stem_thick, 1]);
74         translate([-brace[0]/2, 0, 0])
75           cube([brace[0], brace[1], 1]);
76       }
77     }
78     // xxx needs screw holes
79   }
80   difference(){
81     mirror([0,1,0])
82       translate([-block_width/2, 0, -block_thick])
83       cube([block_width, block_out, block_thick]);
84     TorchMovement();
85   }
86 }
87
88 module Demo(){
89   translate([0, -torch_out, 0])
90     %Torch();
91   Bracket();
92 }
93
94 Demo();
95