chiark / gitweb /
8f04b8f418e843cad7930f046c3b549b5d5c874b
[reprap-play.git] / sprinkler-spike-receptacle.scad
1 // -*- C -*-
2
3 main_height = 95;
4
5 spike_web_thick = 2.52 + 0.75;
6
7 spike_top_width = 21.04 + 1.5;
8
9 spike_botpos_height = 9.5;
10 spike_botpos_width = 11.68 + 0.00;
11
12 topwall_width = 1.5;
13
14 mount_dist = 20;
15 mount_width = 10;
16 mount_height = 5;
17 mount_hole_dia = 4.5;
18 mount_head_dia = 7.5;
19 mount_hole_th = 2.5;
20
21 strap_height = main_height * 0.5;
22
23 strap_width = 5.5;
24 strap_thick = 2.5;
25 strap_around = 2.5;
26 strap_fixing_height = 4.0;
27 strap_fixing_slope = 1.0;
28
29 // calculated
30
31 main_width = spike_top_width + topwall_width*2;
32
33 pos_web_thick = spike_web_thick + topwall_width*2;
34
35 module NegativePlan(){
36   x4z =
37     (spike_top_width - spike_botpos_width) /
38     (main_height - spike_botpos_height);
39
40   x0 = (spike_botpos_width - x4z * spike_botpos_height)/2;
41   x1 =  spike_top_width/2;
42   z1 = main_height;
43
44   polygon([[ x0, -5],
45            [ x0, 0],
46            [ x1, z1],
47            [ x1, z1+5],
48            [-x1, z1+5],
49            [-x1, z1],
50            [-x0, 0],
51            [-x0, -5]]);
52 }
53
54 module SomeMidRounding(sq_size, z_extra) {
55   translate([0,0,-z_extra])
56     linear_extrude(height= main_height + z_extra*2)
57     rotate(45)
58     square( sq_size, center=true );
59 }
60
61 module PositiveMidRounding(){
62   SomeMidRounding(pos_web_thick*2, 0);
63 }
64
65 module NegativeMidRounding(){
66   SomeMidRounding(spike_web_thick*2.5, 5);
67 }
68
69 module PositivePlan(){
70   w = main_width;
71   translate([ -w/2, 0 ])
72     square([ w, main_height ]);
73 }
74
75 module MultiplySolidifyPlan(th){
76   for (r=[0,90]) {
77     rotate([0,0,r])
78       rotate([90,0,0])
79       translate([0,0,-th/2])
80       linear_extrude(height=th)
81       children(0);
82   }
83 }
84
85 module MultiplyForFixings(){
86   for (r=[0:90:270])
87     rotate([0,0,r])
88     children(0);
89 }
90
91 module FixingsPositive(){
92   // mount
93   translate([ -1,
94               -mount_width/2,
95               0 ])
96     cube([ mount_dist + mount_width/2 + 1,
97            mount_width,
98            mount_height ]);
99
100   // strap
101   translate([main_width/2, 0, strap_height]) {
102     hull(){
103       translate([ -strap_around,
104                   -pos_web_thick/2,
105                   -(strap_thick + strap_around) / strap_fixing_slope ])
106         cube([ strap_around,
107                pos_web_thick/2 - strap_width/2,
108                0.5 ]);
109       translate([ -strap_around,
110                   -(strap_around + strap_width/2),
111                   0 ])
112         cube([ strap_around*2 + strap_thick,
113                strap_around,
114                strap_fixing_height ]);
115     }
116     mirror([0,1,0])
117       translate([ strap_thick,
118                   -strap_width/2,
119                   0 ])
120       cube([ strap_around,
121              strap_around + strap_width,
122              strap_fixing_height ]);
123   }
124 }
125
126 module FixingsNegative(){
127   // mount hole
128   translate([ mount_dist, 0,0 ]) {
129     translate([0,0, -1])
130       cylinder(r= mount_hole_dia/2, h= 20, $fn=20);
131     translate([0,0, mount_hole_th])
132       cylinder(r = mount_head_dia/2, h=20, $fn=20);
133   }
134 }
135
136 module Main(){
137   difference(){
138     union(){
139       MultiplySolidifyPlan(pos_web_thick) PositivePlan();
140       PositiveMidRounding();
141       MultiplyForFixings() FixingsPositive();
142     }
143     MultiplySolidifyPlan(spike_web_thick) NegativePlan();
144     NegativeMidRounding();
145     MultiplyForFixings() FixingsNegative();
146   }
147 }
148
149 module PlanTest(){
150   linear_extrude(height=2.0){
151     difference(){
152       PositivePlan();
153       NegativePlan();
154     }
155     difference(){
156       circle(r = spike_botpos_width/2 + 5);
157       circle(r = spike_botpos_width/2);
158       translate([-50, 0]) square([100,50]);
159     }
160   }
161   linear_extrude(height=4.0){
162     difference(){
163       translate([ -main_width/2, 0 ]) square([ main_width, 2 ]);
164       NegativePlan();
165     }
166   }
167 }
168
169 module MainFitTest(){
170   for (top = [0,1]) {
171     translate([ top * (mount_dist*2 + mount_width), 0,0 ]){
172       intersection(){
173         translate([0, 0, (-main_height + 0.5) * top])
174           Main();
175         translate([-50,-50,0])
176           cube([100,100, spike_botpos_height + 1.5]);
177       }
178     }
179   }
180 }
181
182 module Tests(){
183   translate([-mount_dist*3, 0,0])
184     PlanTest();
185   MainFitTest();
186 }
187
188 //Tests();
189 Main();