chiark / gitweb /
earring-stand: EclipRPlan good
[reprap-play.git] / earring-stand.scad
1 // -*- C -*-
2
3 eclip_inner_rad = 2.5;
4 eclip_gap_rad = 0.5;
5 eclip_prong_th = 3;
6 eclip_outer_strt = 0.5;
7 eclip_inner_xstrt = 0.5;
8
9 eclip_ult_angle = 44;
10 eclip_base_epsilon = 0.5;
11
12 test_alpha = 10;
13 test_main_th = 1.5;
14
15 // calculated
16
17 include <utils.scad>
18
19 eclip_inner_strt = eclip_outer_strt + eclip_inner_xstrt;
20
21 r0 = eclip_inner_rad;
22 r1 = r0 + eclip_gap_rad;
23 r2 = r1 + eclip_prong_th;
24 r2e = r1 + eclip_base_epsilon;
25
26 ppxl = -(r0 / sqrt(2)) + (eclip_inner_strt / sqrt(2));
27
28 rgap = eclip_gap_rad;
29
30 $fn=70;
31
32 module EclipLPlanCore(alpha){
33   FArcSegment(0,0, r1,r2,
34               180-eclip_ult_angle, eclip_ult_angle-alpha +1);
35
36   difference(){
37     hull(){
38       intersection(){
39         circle(r2);
40         rotate(-alpha) mirror([1,1]) square([r2e, 50]);
41      }
42       rotate(-alpha) mirror([1,1]) square([r2e, r2]);
43     }
44     circle(r1);
45   }
46 }
47
48 module EclipRPlan(alpha, main_th){
49   intersection(){
50     rotate(alpha)
51       translate([ppxl + main_th + rgap, -r2*2])
52       square([eclip_prong_th, r2*(2 + 1/sqrt(2))]);
53     translate([-r2, -r2e])
54       square([r2*3, eclip_base_epsilon + r2*4]);
55   }
56 }
57
58 module EclipLPlan(alpha){
59   rotate(alpha) EclipLPlanCore(alpha);
60 }
61
62 module EclipPPlan(main_th){
63   intersection(){
64     hull(){
65       circle(r0);
66       rotate(90-eclip_ult_angle) square([r0,r0]);
67     }
68     translate([-(r0+.1), -(r0+.1)])
69       square([(r0+.1) + main_th + ppxl, r2*2]);
70   }
71   translate([ppxl, 0]) square([main_th, r2]);
72 }
73
74 color("red") EclipLPlan(test_alpha);
75 color("blue") rotate(test_alpha) EclipPPlan(test_main_th);
76 color("green") EclipRPlan(test_alpha, test_main_th);