chiark / gitweb /
sprinkler-spike-receptacle: break out pos_web_thick
[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 PositivePlan(){
47   w = main_width;
48   translate([ -w/2, 0 ])
49     square([ w, main_height ]);
50 }
51
52 module MultiplySolidifyPlan(th){
53   for (r=[0,90]) {
54     rotate([0,0,r])
55       rotate([90,0,0])
56       translate([0,0,-th/2])
57       linear_extrude(height=th)
58       children(0);
59   }
60 }
61
62 module MultiplyForMount(){
63   for (r=[0:90:270])
64     rotate([0,0,r])
65     children(0);
66 }
67
68 module Mount(){
69   translate([ -1,
70               -mount_width/2,
71               0 ])
72     cube([ mount_dist + mount_width/2 + 1,
73            mount_width,
74            mount_height ]);
75 }
76
77 module MountHole(){
78   translate([ mount_dist, 0,0 ]) {
79     translate([0,0, -1])
80       cylinder(r= mount_hole_dia/2, h= 20, $fn=20);
81     translate([0,0, mount_hole_th])
82       cylinder(r = mount_head_dia/2, h=20, $fn=20);
83   }
84 }
85
86 module Main(){
87   difference(){
88     union(){
89       MultiplySolidifyPlan(pos_web_thick) PositivePlan();
90       MultiplyForMount() Mount();
91     }
92     MultiplySolidifyPlan(spike_web_thick) NegativePlan();
93     MultiplyForMount() MountHole();
94   }
95 }
96
97 module PlanTest(){
98   linear_extrude(height=2.0){
99     difference(){
100       PositivePlan();
101       NegativePlan();
102     }
103     difference(){
104       circle(r = spike_botpos_width/2 + 5);
105       circle(r = spike_botpos_width/2);
106       translate([-50, 0]) square([100,50]);
107     }
108   }
109   linear_extrude(height=4.0){
110     difference(){
111       translate([ -main_width/2, 0 ]) square([ main_width, 2 ]);
112       NegativePlan();
113     }
114   }
115 }
116
117 module MainFitTest(){
118   intersection(){
119     translate([0,0, -main_height + 0.5])
120       Main();
121     translate([-50,-50,0])
122       cube([100,100,100]);
123   }
124 }
125
126 //PlanTest();
127 //Main();
128 MainFitTest();