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