chiark / gitweb /
ksafe-base: wip, params
[reprap-play.git] / ksafe-base.scad
1 // -*- C -*-
2
3 // xxx
4 bolt_above = 4;
5 wall_thick = 4;
6 bolthole_height = 4;
7 bolthole_width = 10;
8 web_thick = 4;
9 bolthole_rhs = 20;
10 bolthole_lhs = 20;
11 boltreinf_thick = 6;
12 anchor_wall_space = 45;
13 base_thick = 4;
14 lidinner_thick_allow = 20;
15 space = 25;
16 anchor_thick = 4;
17 anchor_rad = 4;
18 bevel = 15;
19 cnr_rad = 10;
20
21 // ----- calculated -----
22
23 gppA = [0,0];
24 gppB = gppA - [ wall_thick, 0 ];
25
26 gppL = [ gppB[0], -(lidinner_thick_allow + space + base_thick) ];
27
28 // anchor
29
30 anchor_b = anchor_thick + anchor_rad;
31 appM = gppL + anchor_b * [1,1];
32
33 a_bevel = 2 * anchor_b * (1 + sqrt(0.5));
34
35 module upp_app_Vars(t_bevel){
36   $xppE = gppL + t_bevel * [0,1];
37   $xppF = gppL + t_bevel * [1,0];
38
39   $xppJ = $xppE + wall_thick * [ 1, tan(22.5) ];
40   $xppI = $xppF + base_thick * [ tan(22.5), 1 ];
41
42   children();
43 }
44
45 module upp_app_Profile(){
46   polygon([ gppA,
47             gppB,
48             $xppE,
49             $xppF,
50             $xppF + [1,0],
51             $xppI + [1,0],
52             $xppJ ]);
53 }
54
55
56 module UsualProfile(){
57   upp_app_Vars(bevel) upp_app_Profile();
58 }
59
60 module NearAnchorProfile(){
61   upp_app_Vars(a_bevel) upp_app_Profile();
62 }
63
64 module AnchorProfile(){
65   upp_app_Vars(a_bevel) {
66
67     upp_app_Profile();
68
69     difference(){
70       hull(){
71         polygon([ $xppE,
72                   $xppF,
73                   $xppF + [0,1],
74                   $xppE + [1,0] ]);
75         translate(appM) circle(r= anchor_b);
76       }
77       translate(appM) circle(r= anchor_rad);
78     }
79   }
80 }
81
82 module AnchorWallProfile(){
83   UsualProfile();
84   NearAnchorProfile();
85   hull(){
86     for (bev = [bevel, a_bevel]) {
87       upp_app_Vars(bev) {
88         polygon([ $xppE,
89                   $xppF,
90                   $xppI,
91                   $xppJ ]);
92       }
93     }
94   }
95 }
96
97 module Demo(){
98   translate([0,0,-2]) color("yellow") AnchorWallProfile();
99   color("red") AnchorProfile();
100   translate([0,0,2]) color("black") NearAnchorProfile();
101   translate([0,0,4]) color("blue") UsualProfile();
102 }
103
104 Demo();