chiark / gitweb /
nook-case: wip, top
[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 // calculated
16
17 ledge_h = case_th;
18 lid_th = case_th;
19
20 spp0 = [0,0];
21 spp1 = spp0 + case_th * [-1,0];
22 spp9 = spp0 + ledge_h * [0,-1];
23 spp8 = spp9 + nook_th * [0,-1];
24 spp7 = spp8 + case_th * [-1,-1];
25
26 spp11y = spp1[1] - tape_th;
27 spp4y  = 0.5 * (spp0[1] + spp8[1]);
28 spp3y = spp4y + tape_inside/2;  spp5y = spp4y - tape_inside/2;
29 spp2y = spp3y + tape_th;        spp6y = spp5y - tape_th;
30
31 spp20 = spp8 + nook_cnr_rad * [1,0];
32 spp20x = spp20[0];
33
34 tppA = spp0 + gap;
35 tppB = spp1 + [0, gap[1]];
36 tppC = tppB + lid_th * [0,1];
37 tppD = [ spp20x, tppC[1] ];
38 tppE = [ spp20x, tppB[1] ];
39 tppF = tppA + ledge_w * [1,0];
40 tppG = tppF + ledge_h * [0,-1];
41 tppH = [ tppA[0], tppG[1] ];
42
43 tppJx = tppA[0] + tape_th;
44
45 module SideMainProfile() {
46   rectfromto(spp7, spp0);
47   rectfromto(spp7, spp20);
48 }
49
50 module TopTapeCutout() {
51   polygon([ tppA,
52             tppA + [-1,-1],
53             tppH + [-1,-1],
54             [ tppJx, tppH[1]-1 ],
55             [ tppJx, tppC[1]+1 ],
56             [ tppA[0], tppC[1]+1 ]]);
57 }
58
59 module TopMainProfile() {
60   l = [ tppA, tppB, tppC, tppD, tppE, tppF, tppG, tppH ];
61   echo(l);
62   polygon(l);
63 }
64
65 module SideTapeCutout1(y0,y1) {
66   rectfromto([ spp7[0]-1, y0 ],
67              [ spp8[0]+1, y1 ]);
68 }
69
70 module SideTapeCutout() {
71   SideTapeCutout1(spp6y, spp5y);
72   SideTapeCutout1(spp3y, spp2y);
73   SideTapeCutout1(spp3y, spp2y);
74   SideTapeCutout1(spp11y, spp1[1] + 1);
75 }
76
77 module Demo(){
78   translate([0,0,-2]) color("red") SideMainProfile(); 
79   translate([0,0,-2]) color("purple") TopMainProfile();
80   difference(){
81     SideMainProfile();
82     SideTapeCutout();
83   }
84   translate([0,0,0]) color("yellow") difference(){
85     TopMainProfile();
86     TopTapeCutout();
87   }
88   //%SideTapeCutout();
89 }
90
91 Demo();