chiark / gitweb /
b21b6939f94952fa26bd66ed445b3d8f3c8b79b1
[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 = 5;
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_Profile(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   polygon([ gppA,
37             gppB,
38             xppE,
39             xppF,
40             xppF + [1,0],
41             xppI + [1,0],
42             xppJ ]);
43 }
44
45
46 module UsualProfile(){
47   upp_app_Profile(bevel);
48 }
49
50 module NearAnchorProfile(){
51   upp_app_Profile(a_bevel);
52 }
53
54 module AnchorProfile(){
55   xppE = gppL + t_bevel * [0,1];
56   xppF = gppL + t_bevel * [1,0];
57
58   upp_app_Profile(a_bevel);
59
60   difference(){
61     hull(){
62       polygon([ xppE,
63                 xppF,
64                 xppF + [0,1],
65                 xppE + [1,0] ]);
66       translate(appM) circle(r= anchor_b);
67     }
68     translate(appM) circle(r= anchor_rad);
69   }
70 }
71
72 module Demo(){
73   color("red") AnchorProfile();
74   translate([0,0,2]) color("black") NearAnchorProfile();
75   color("blue") UsualProfile();
76 }
77
78 Demo();