chiark / gitweb /
296c9e0f8e6a32e4eb33622d6fdba7f3bac772df
[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 module NegativePlan(){
26   x4z =
27     (spike_top_width - spike_botpos_width) /
28     (main_height - spike_botpos_height);
29
30   x0 = (spike_botpos_width - x4z * spike_botpos_height)/2;
31   x1 =  spike_top_width/2;
32   z1 = main_height;
33
34   polygon([[ x0, -5],
35            [ x0, 0],
36            [ x1, z1],
37            [ x1, z1+5],
38            [-x1, z1+5],
39            [-x1, z1],
40            [-x0, 0],
41            [-x0, -5]]);
42 }
43
44 module PositivePlan(){
45   w = main_width;
46   translate([ -w/2, 0 ])
47     square([ w, main_height ]);
48 }
49
50 module MultiplySolidifyPlan(th){
51   for (r=[0,90]) {
52     rotate([0,0,r])
53       rotate([90,0,0])
54       translate([0,0,-th/2])
55       linear_extrude(height=th)
56       children(0);
57   }
58 }
59
60 module MultiplyForMount(){
61   for (r=[0:90:270])
62     rotate([0,0,r])
63     children(0);
64 }
65
66 module Mount(){
67   translate([ -1,
68               -mount_width/2,
69               0 ])
70     cube([ mount_dist + mount_width/2 + 1,
71            mount_width,
72            mount_height ]);
73 }
74
75 module MountHole(){
76   translate([ mount_dist, 0,0 ]) {
77     translate([0,0, -1])
78       cylinder(r= mount_hole_dia/2, h= 20, $fn=20);
79     translate([0,0, mount_hole_th])
80       cylinder(r = mount_head_dia/2, h=20, $fn=20);
81   }
82 }
83
84 module Main(){
85   difference(){
86     union(){
87       MultiplySolidifyPlan(spike_web_thick + topwall_width*2) PositivePlan();
88       MultiplyForMount() Mount();
89     }
90     MultiplySolidifyPlan(spike_web_thick) NegativePlan();
91     MultiplyForMount() MountHole();
92   }
93 }
94
95 module PlanTest(){
96   linear_extrude(height=2.0){
97     difference(){
98       PositivePlan();
99       NegativePlan();
100     }
101     difference(){
102       circle(r = spike_botpos_width/2 + 5);
103       circle(r = spike_botpos_width/2);
104       translate([-50, 0]) square([100,50]);
105     }
106   }
107   linear_extrude(height=4.0){
108     difference(){
109       translate([ -main_width/2, 0 ]) square([ main_width, 2 ]);
110       NegativePlan();
111     }
112   }
113 }
114
115 //PlanTest();
116 Main();