chiark / gitweb /
nook-case: wip
[reprap-play.git] / nook-case.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 nook_th = 8; // xxx
6 nook_cnr_rad = 10;
7
8 case_th = 2.5;
9 ledge_w = 4;
10 tape_th = 1.5;
11 tape_inside = 2.0;
12
13 gap = 0.5 * [1,1];
14
15 tape_w = 12; // xxx
16
17 test_pillar = 4;
18
19 // calculated
20
21 ledge_h = case_th;
22 lid_th = case_th;
23
24 spp0 = [0,0];
25 spp1 = spp0 + case_th * [-1,0];
26 spp9 = spp0 + ledge_h * [0,-1];
27 spp8 = spp9 + nook_th * [0,-1];
28 spp7 = spp8 + case_th * [-1,-1];
29
30 spp11y = spp1[1] - tape_th;
31 spp4y  = 0.5 * (spp0[1] + spp7[1]);
32 spp3y = spp4y + tape_inside/2;  spp5y = spp4y - tape_inside/2;
33 spp2y = spp3y + tape_th;        spp6y = spp5y - tape_th;
34
35 spp20 = spp8 + nook_cnr_rad * [1,0];
36 spp20x = spp20[0];
37
38 tppA = spp0 + gap;
39 tppB = spp1 + [0, gap[1]];
40 tppC = tppB + lid_th * [0,1];
41 tppD = [ spp20x, tppC[1] ];
42 tppE = [ spp20x, tppB[1] ];
43 tppF = tppA + ledge_w * [1,0];
44 tppG = tppF + ledge_h * [0,-1];
45 tppH = [ tppA[0], tppG[1] ];
46
47 tppJx = tppA[0] + tape_th;
48
49 module SideMainProfile() {
50   rectfromto(spp7, spp0);
51   rectfromto(spp7, spp20);
52 }
53
54 module TopTapeCutout() {
55   polygon([ tppA,
56             tppA + [-1,-1],
57             tppH + [-1,-1],
58             [ tppJx, tppH[1]-1 ],
59             [ tppJx, tppC[1]+1 ],
60             [ tppA[0], tppC[1]+1 ]]);
61 }
62
63 module TopMainProfile() {
64   l = [ tppA, tppB, tppC, tppD, tppE, tppF, tppG, tppH ];
65   echo(l);
66   polygon(l);
67 }
68
69 module SideTapeCutout1(y0,y1) {
70   rectfromto([ spp7[0]-1, y0 ],
71              [ spp8[0]+1, y1 ]);
72 }
73
74 module SideTapeCutout() {
75   SideTapeCutout1(spp6y, spp5y);
76   SideTapeCutout1(spp3y, spp2y);
77   SideTapeCutout1(spp3y, spp2y);
78   SideTapeCutout1(spp11y, spp1[1] + 1);
79 }
80
81 module Demo(){ ////toplevel
82   translate([0,0,-2]) SideMainProfile(); 
83   translate([0,0,-2]) color("yellow") TopMainProfile();
84   color("red") difference(){
85     SideMainProfile();
86     SideTapeCutout();
87   }
88   translate([0,0,0]) color("purple") difference(){
89     TopMainProfile();
90     TopTapeCutout();
91   }
92   //%SideTapeCutout();
93 }
94
95 module TestExtrude(){
96   difference(){
97     linextr_y_xz(-test_pillar, tape_w+test_pillar) children(0);
98     linextr_y_xz(           0, tape_w            ) children(1);
99   }
100 }
101
102 module TestSide(){ ////toplevel
103   TestExtrude() { SideMainProfile(); SideTapeCutout(); }
104 }
105
106 module TestTop(){ ////toplevel
107   TestExtrude() { TopMainProfile(); TopTapeCutout(); }
108 }
109 module TestTopPrint(){ ////toplevel
110   rotate([180,0,0]) TestTop();
111 }