chiark / gitweb /
bf470dc06aaa6eac2c53635c932fa751d60bad83
[reprap-play.git] / sprinkler-spike-receptacle.scad
1 // -*- C -*-
2
3 main_height = 95;
4
5 spike_web_thick = 2.52 + 0.5;
6
7 spike_top_width = 21.04;
8
9 spike_botpos_height = 9.5;
10 spike_botpos_width = 11.68;
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 // calculated
22
23 main_width = spike_top_width + topwall_width*2;
24
25 pos_web_thick = spike_web_thick + topwall_width*2;
26
27 module NegativePlan(){
28   x4z =
29     (spike_top_width - spike_botpos_width) /
30     (main_height - spike_botpos_height);
31
32   x0 = (spike_botpos_width - x4z * spike_botpos_height)/2;
33   x1 =  spike_top_width/2;
34   z1 = main_height;
35
36   polygon([[ x0, -5],
37            [ x0, 0],
38            [ x1, z1],
39            [ x1, z1+5],
40            [-x1, z1+5],
41            [-x1, z1],
42            [-x0, 0],
43            [-x0, -5]]);
44 }
45
46 module SomeMidRounding(sq_size, z_extra) {
47   translate([0,0,-z_extra])
48     linear_extrude(height= main_height + z_extra*2)
49     rotate(45)
50     square( sq_size, center=true );
51 }
52
53 module PositiveMidRounding(){
54 //  translate([0,0,-5])
55 //    linear_extrude(height= main_height + 10)
56 //    rotate(45)
57 //    square( spike_web_thick*2.5, center=true );
58 }
59
60 module NegativeMidRounding(){
61   SomeMidRounding(spike_web_thick*2.5, 5);
62 }
63
64 module PositivePlan(){
65   w = main_width;
66   translate([ -w/2, 0 ])
67     square([ w, main_height ]);
68 }
69
70 module MultiplySolidifyPlan(th){
71   for (r=[0,90]) {
72     rotate([0,0,r])
73       rotate([90,0,0])
74       translate([0,0,-th/2])
75       linear_extrude(height=th)
76       children(0);
77   }
78 }
79
80 module MultiplyForMount(){
81   for (r=[0:90:270])
82     rotate([0,0,r])
83     children(0);
84 }
85
86 module Mount(){
87   translate([ -1,
88               -mount_width/2,
89               0 ])
90     cube([ mount_dist + mount_width/2 + 1,
91            mount_width,
92            mount_height ]);
93 }
94
95 module MountHole(){
96   translate([ mount_dist, 0,0 ]) {
97     translate([0,0, -1])
98       cylinder(r= mount_hole_dia/2, h= 20, $fn=20);
99     translate([0,0, mount_hole_th])
100       cylinder(r = mount_head_dia/2, h=20, $fn=20);
101   }
102 }
103
104 module Main(){
105   difference(){
106     union(){
107       MultiplySolidifyPlan(pos_web_thick) PositivePlan();
108       PositiveMidRounding();
109       MultiplyForMount() Mount();
110     }
111     MultiplySolidifyPlan(spike_web_thick) NegativePlan();
112     NegativeMidRounding();
113     MultiplyForMount() MountHole();
114   }
115 }
116
117 module PlanTest(){
118   linear_extrude(height=2.0){
119     difference(){
120       PositivePlan();
121       NegativePlan();
122     }
123     difference(){
124       circle(r = spike_botpos_width/2 + 5);
125       circle(r = spike_botpos_width/2);
126       translate([-50, 0]) square([100,50]);
127     }
128   }
129   linear_extrude(height=4.0){
130     difference(){
131       translate([ -main_width/2, 0 ]) square([ main_width, 2 ]);
132       NegativePlan();
133     }
134   }
135 }
136
137 module MainFitTest(){
138   intersection(){
139     translate([0,0, -main_height + 0.5])
140       Main();
141     translate([-50,-50,0])
142       cube([100,100,100]);
143   }
144 }
145
146 //PlanTest();
147 //Main();
148 MainFitTest();