chiark / gitweb /
maglite-holder: screw holes
[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 hole_dia = 4 + 0.5;
25 hole_slot = 5;
26
27 $fa=5;
28
29 // calculated
30
31 above = torch_big_len + torch_clear + torch_clear_below;
32
33 holes = [ 172, 265 ];
34
35 stem_below = stem_width/2;
36
37 stem_len = holes[1] - above + stem_below;
38
39 torch_out = stem_thick + torch_big_dia/2 + torch_out_more;
40
41 block_width = arm_width*2 + torch_big_dia;
42
43 block_out = torch_out + torch_big_dia/2/sqrt(2);
44
45 module Torch(){
46   mirror([0,0,1]){
47     hull(){
48       rotate_extrude()
49         translate(dxf_off)
50         import(file="maglite-holder-torch-curve.dxf",
51                convexity=10, center=true);
52     }
53     translate([0,0, -1])
54       cylinder(r=torch_lit_dia/2, h= torch_tot_len - torch_big_len + 1);
55   }
56 }
57
58 module ScrewHole(y, rot) {
59   translate([0,0, above -y]){
60     rotate([0,rot,0]){
61       hull(){
62         for (d= [-1,+1] * hole_slot/2) {
63           translate([d,0,0])
64             rotate([90,0,0])
65             translate([0,0,-stem_thick*2])
66             cylinder(r= hole_dia/2, h= stem_thick*4);
67         }
68       }
69     }
70   }
71 }    
72
73 module TorchMovement(){
74   // xxx needs torch increasing for slop
75   translate([0, -torch_out, 0]) {
76     translate([0, 0, -torch_recess])
77       Torch();
78     rotate([90,0,0])
79       linear_extrude(height= block_out)
80       projection() rotate([-90,0,0]) Torch();
81   }
82 }
83
84 module Bracket(){
85   difference(){
86     mirror([0,1,0]) {
87       translate([-stem_width/2, 0, -stem_len])
88         cube([stem_width, stem_thick, stem_len]);
89       translate([0,0, -block_thick]) hull(){
90         translate([-stem_width/2, 0, -brace[2]])
91           cube([stem_width, stem_thick, 1]);
92         translate([-brace[0]/2, 0, 0])
93           cube([brace[0], brace[1], 1]);
94       }
95     }
96     ScrewHole(holes[0], 90);
97     ScrewHole(holes[1], 0);
98   }
99   difference(){
100     mirror([0,1,0])
101       translate([-block_width/2, 0, -block_thick])
102       cube([block_width, block_out, block_thick]);
103     TorchMovement();
104   }
105 }
106
107 module Demo(){
108   translate([0, -torch_out, 0])
109     %Torch();
110   Bracket();
111 }
112
113 Demo();
114