chiark / gitweb /
commitid-layering-test: add moat around cylinder to show XY registration
[reprap-play.git] / velux-window-grip.scad
1 // -*- C -*-
2
3 include <funcs.scad>
4
5 // MainLoop
6
7 main_thick = 7.0;
8 main_in_dia = 28.9;
9
10 horn_ext_dia = 20 - 0.5;
11
12 horn_c_x = -4.6;
13 horn_c_dy= -4;
14
15 blhook_start_ang = 45;
16 blhook_in_rad = 1.85;
17 blhook_str_len = 2.9;
18
19 width = 20;
20
21 // Attach
22
23 at_bolt_into = 13.0 + 0.5;
24 at_tube_dia = 16.7 + 0.5;
25 at_prong_minw = 4;
26 at_rear_thick = 4.5;
27 at_bolt_dia = 5 + 0.5;
28
29 at_rear_width = at_tube_dia;
30 at_stem_len = main_in_dia/2 * 0.3;
31
32 at_prong_depth = at_bolt_into * 2;
33 at_gap_width = at_tube_dia * 0.75;
34
35 // computed
36
37 blhook_mid_rad = blhook_in_rad + main_thick/2;
38 mc_mid_rad = main_in_dia/2 + main_thick/2;
39
40 mc_bl = circle_point([0,0], mc_mid_rad, 270-blhook_start_ang);
41
42 at_block_x = at_tube_dia + at_prong_minw * 2;
43 at_block_y = at_prong_depth + at_rear_thick;
44 at_block_z = width;
45
46 at_stem_yy = at_stem_len + mc_mid_rad;
47
48 at_offset_y = at_block_y + at_stem_len + mc_mid_rad;
49
50 $fs=0.05;
51
52 horn_thick = main_thick;
53
54 module MainLoop(){
55   intersection(){
56     difference(){
57       circle(r= main_in_dia/2 + main_thick, $fn=50);
58       circle(r= main_in_dia/2, $fn=50);
59     }
60     polygon([[0,0],
61              3*mc_bl,
62              [0, -100],
63              [100,-100],
64              [100,100],
65              [0,100]]);
66   }
67   translate(mc_bl)
68     circle(main_thick/2);
69   translate([horn_c_x, mc_mid_rad + horn_c_dy])
70     intersection(){
71     difference(){
72       circle(horn_ext_dia/2);
73       intersection(){
74         circle(horn_ext_dia/2 - horn_thick);
75         polygon([[-50,-50],
76                  [-50,-horn_c_dy],
77                  [50,-horn_c_dy],
78                  [50,-50]]);
79       }
80     }
81     polygon([[0,0],
82               [-50,0],
83               [0,50]]);
84   }
85   translate([0,main_in_dia/2]) mirror([1,0])
86     square([-horn_c_x + horn_ext_dia/2 * 0.75, main_thick]);
87   translate(mc_bl){
88     translate([-blhook_str_len/2, 0])
89       square(center=true, [blhook_str_len, main_thick]);
90     translate([-blhook_str_len, blhook_mid_rad]){
91       intersection(){
92         difference(){
93           circle(r=blhook_mid_rad + main_thick/2);
94           circle(r=blhook_mid_rad - main_thick/2);
95         }
96         mirror([1,1]) square(50);
97       }
98     }
99   }
100 }
101
102 module MainLoopTest(){
103   linear_extrude(height=1.6)
104     MainLoop();
105 }
106
107 module Attach(){
108   difference(){
109     translate([0, at_block_y/2, 0])
110       cube(center=true, [at_block_x, at_block_y, at_block_z]);
111     translate([0, at_prong_depth/2-1, 0])
112       cube(center=true, [at_gap_width, at_prong_depth+2, at_block_z+1]);
113     translate([0,-1,0])
114       rotate([-90,0,0])
115       cylinder(r= at_tube_dia/2, h= at_prong_depth+1);
116     translate([-50, at_prong_depth-at_bolt_into, 0])
117       rotate([0,90,0])
118       cylinder(r= at_bolt_dia/2, h= 100);
119   }
120   difference(){
121     translate([0, at_block_y + at_stem_yy/2 - 0.1, 0])
122       cube(center=true, [at_tube_dia, at_stem_yy + 0.2, at_block_z]);
123     translate([0, at_offset_y, -50])
124       cylinder(r = mc_mid_rad, 100);
125   }
126 }
127
128 module Combine(){
129   rotate([0,0,45]) translate([0,-main_thick/2,0]){
130     linear_extrude(height=width)
131       translate([0,at_offset_y,0])
132       MainLoop();
133     translate([0,0, width/2])
134       Attach();
135   }
136 }
137
138 Combine();