chiark / gitweb /
sprinkler-spike-receptacle: adjustments
[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 + 1.0;
8
9 spike_botpos_height = 9.5;
10 spike_botpos_width = 11.68 + 0.50;
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   SomeMidRounding(pos_web_thick*2, 0);
55 }
56
57 module NegativeMidRounding(){
58   SomeMidRounding(spike_web_thick*2.5, 5);
59 }
60
61 module PositivePlan(){
62   w = main_width;
63   translate([ -w/2, 0 ])
64     square([ w, main_height ]);
65 }
66
67 module MultiplySolidifyPlan(th){
68   for (r=[0,90]) {
69     rotate([0,0,r])
70       rotate([90,0,0])
71       translate([0,0,-th/2])
72       linear_extrude(height=th)
73       children(0);
74   }
75 }
76
77 module MultiplyForMount(){
78   for (r=[0:90:270])
79     rotate([0,0,r])
80     children(0);
81 }
82
83 module Mount(){
84   translate([ -1,
85               -mount_width/2,
86               0 ])
87     cube([ mount_dist + mount_width/2 + 1,
88            mount_width,
89            mount_height ]);
90 }
91
92 module MountHole(){
93   translate([ mount_dist, 0,0 ]) {
94     translate([0,0, -1])
95       cylinder(r= mount_hole_dia/2, h= 20, $fn=20);
96     translate([0,0, mount_hole_th])
97       cylinder(r = mount_head_dia/2, h=20, $fn=20);
98   }
99 }
100
101 module Main(){
102   difference(){
103     union(){
104       MultiplySolidifyPlan(pos_web_thick) PositivePlan();
105       PositiveMidRounding();
106       MultiplyForMount() Mount();
107     }
108     MultiplySolidifyPlan(spike_web_thick) NegativePlan();
109     NegativeMidRounding();
110     MultiplyForMount() MountHole();
111   }
112 }
113
114 module PlanTest(){
115   linear_extrude(height=2.0){
116     difference(){
117       PositivePlan();
118       NegativePlan();
119     }
120     difference(){
121       circle(r = spike_botpos_width/2 + 5);
122       circle(r = spike_botpos_width/2);
123       translate([-50, 0]) square([100,50]);
124     }
125   }
126   linear_extrude(height=4.0){
127     difference(){
128       translate([ -main_width/2, 0 ]) square([ main_width, 2 ]);
129       NegativePlan();
130     }
131   }
132 }
133
134 module MainFitTest(){
135   for (top = [0,1]) {
136     translate([ top * (mount_dist*2 + mount_width), 0,0 ]){
137       intersection(){
138         translate([0, 0, (-main_height + 0.5) * top])
139           Main();
140         translate([-50,-50,0])
141           cube([100,100,0.5]);
142       }
143     }
144   }
145 }
146
147 //PlanTest();
148 //MainFitTest();
149 Main();