chiark / gitweb /
nook-case: wip
[reprap-play.git] / nook-case.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 nook_th = 12.41 + 0.50;
6 nook_w = 127.12 + 0.75;
7 nook_h = 123.44 + 21.88 + 21.05 + 0.75;
8
9 nook_cnr_rad = 10;
10
11 case_th = 2.5;
12 ledge_w = 4;
13 tape_th = 1.75;
14 tape_inside = 2.0;
15
16 gap = 0.5 * [1,1];
17
18 tape_w = 15;
19
20 test_pillar = 4;
21
22 // calculated
23
24 ledge_h = case_th;
25 lid_th = case_th;
26
27 spp0 = [0,0];
28 spp1 = spp0 + case_th * [-1,0];
29 spp9 = spp0 + ledge_h * [0,-1];
30 spp8 = spp9 + nook_th * [0,-1];
31 spp7 = spp8 + case_th * [-1,-1];
32
33 spp11y = spp1[1] - tape_th;
34 spp4y  = 0.5 * (spp0[1] + spp7[1]);
35 spp3y = spp4y + tape_inside/2;  spp5y = spp4y - tape_inside/2;
36 spp2y = spp3y + tape_th;        spp6y = spp5y - tape_th;
37
38 spp20 = spp8 + nook_cnr_rad * [1,0];
39 spp20x = spp20[0];
40
41 tppA = spp0 + gap;
42 tppB = spp1 + [0, gap[1]];
43 tppC = tppB + lid_th * [0,1];
44 tppD = [ spp20x, tppC[1] ];
45 tppE = [ spp20x, tppB[1] ];
46 tppF = tppA + ledge_w * [1,0];
47 tppG = tppF + ledge_h * [0,-1];
48 tppH = [ tppA[0], tppG[1] ];
49
50 tppJx = tppA[0] + tape_th;
51
52 module SideMainProfile() {
53   rectfromto(spp7, spp0);
54   rectfromto(spp7, spp20);
55 }
56
57 module TopTapeCutout() {
58   polygon([ tppA,
59             tppA + [-1,-1],
60             tppH + [-1,-1],
61             [ tppJx, tppH[1]-1 ],
62             [ tppJx, tppC[1]+1 ],
63             [ tppA[0], tppC[1]+1 ]]);
64 }
65
66 module TopMainProfile() {
67   l = [ tppA, tppB, tppC, tppD, tppE, tppF, tppG, tppH ];
68   echo(l);
69   polygon(l);
70 }
71
72 module SideTapeCutout1(y0,y1) {
73   rectfromto([ spp7[0]-1, y0 ],
74              [ spp8[0]+1, y1 ]);
75 }
76
77 module SideTapeCutout() {
78   SideTapeCutout1(spp6y, spp5y);
79   SideTapeCutout1(spp3y, spp2y);
80   SideTapeCutout1(spp3y, spp2y);
81   SideTapeCutout1(spp11y, spp1[1] + 1);
82 }
83
84 module Demo(){ ////toplevel
85   translate([0,0,-2]) SideMainProfile(); 
86   translate([0,0,-2]) color("yellow") TopMainProfile();
87   color("red") difference(){
88     SideMainProfile();
89     SideTapeCutout();
90   }
91   translate([0,0,0]) color("purple") difference(){
92     TopMainProfile();
93     TopTapeCutout();
94   }
95   //%SideTapeCutout();
96 }
97
98 module FaceCore(y0,y1){
99   nom_cnr = 0.5 * [nook_w, nook_h, 0] - nook_cnr_rad * [1,1,0];
100
101   for (mx=[0,1]) mirror([mx,0,0]) {
102       for (my=[0,1]) mirror([0,my,0]) {
103           translate(-nom_cnr) {
104             rotate_extrude(angle=90, convexity=10)
105               translate(-[1,0,0] * nook_cnr_rad)
106               children(0);
107           }
108         }
109       translate([nook_w/2, 0,0])
110         linextr_y_xz(-nom_cnr[1]-0.1, nom_cnr[1]+0.1)
111         children(0);
112     }
113   for (my=[0,1]) mirror([0,my,0]) {
114       translate([0, -nook_h/2, 0])
115         linextr_x_yz(-nom_cnr[0]-0.1, nom_cnr[0]+0.1)
116         children(0);
117     }
118 }
119
120 module Base(){ ////toplevel
121   FaceCore(0,0)
122     SideMainProfile();
123 }
124
125 module Top(){ ////toplevel
126   FaceCore(0,0)
127     TopMainProfile();
128 }
129
130 module TestExtrude(){
131   difference(){
132     linextr_y_xz(-test_pillar, tape_w+test_pillar) children(0);
133     linextr_y_xz(           0, tape_w            ) children(1);
134   }
135 }
136
137 module TestSide(){ ////toplevel
138   TestExtrude() { SideMainProfile(); SideTapeCutout(); }
139 }
140
141 module TestTop(){ ////toplevel
142   TestExtrude() { TopMainProfile(); TopTapeCutout(); }
143 }
144 module TestTopPrint(){ ////toplevel
145   rotate([180,0,0]) TestTop();
146 }