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