5 phone = [ 75.0, 145.0 ];
7 prop_buildout_less = 3;
9 prop_angles = [ 15, 30, 45, 60 ];
11 bumper = [ 0.250, -0.025 ];
12 // ^ One side. Overall size is increased by twice this.
13 // If no bumpers, is the gap around the phone.
19 // 1: simply an opening
20 // 2: opening with separate cover model, for printing in clear (two colour)
21 // 3: like 2 but one-layer window for ad-hoc multi-colour
23 initial_layer_thick = 0.400; // ^ needed for mode 3 only
24 initial_layer_width = 0.750; // ^ needed for mode 3 only
25 multicolour_gap = 0.15; // each side
28 phone_rim_depth = 0.80; // includes allowance for a screen protector
30 button_cutout_depth = 9;
32 phone_edge_thick = 9.0;
33 phone_total_thick = 12.0;
34 phone_backside_slope_inner = 1.5; // larger means shallower
35 phone_backside_slope_outer = 1.0; // larger means shallower
37 camera_pos_tl = [ 6.450, 12.750 ]; // measured from tl corner
38 camera_pos_br = [ 22.300, 37.600 ]; // tl/br as seen from back
40 jack_pos = [ 13.83, 8.485 ];
41 jack_dia = 10.64 + .5; // some jack I had lying around
43 led_pos = [ 13.98, 10.00 ];
45 led_window_ledge = 0.75; // each side
47 noisecancelmic_pos = [ 19.54, 7.37 ]; // from rhs
48 noisecancelmic_dia = 4.00;
50 //fingerpushhole_dias = [ 15, 18 ];
51 fingerpushhole_dias = [];
53 rearspeaker_pos_bl = [ 12.64, 18.72 ];
54 rearspeaker_size = [ 3.76, 7.36 ];
56 microusb_above = 3.27 - 0.25;
58 microusb_width = 16.12 + 1.25;
65 lid_screen_gap_extra = .66;
67 case_struts_count = 6;
68 case_struts_solid_below = 1.00;
69 case_struts_solid_above = 0.75;
70 case_struts_width = 0.10;
74 keeper_inner_width = 2.75;
75 keeper_inner_height = 2.75;
76 keeper_slant_slope = 2; // larger means steeper
78 keeper_gap_z_top = 0.25;
79 keeper_gap_z_bot = 0.75;
81 keeper_gap_x_holes = 0.75;
83 keeper_side = 0; // 0 = lhs; 1 = rhs
94 foldover_lever_gap = 0.50;
96 // properties of the hinge fasteners
97 hingescrew_shaft_dia = 2.0 + 0.25; // M2 x 12mm machine screw
98 hingescrew_shaft_len = 12;
99 hingescrew_fasteners_extra_thick = 0.40;
100 // ^ amount of thread protruding if everything was completely nominal
101 // and we are using two nuts
102 hingescrew_nut_access_dia = 4.72 + 0.50;
103 // ^ washer is 4.72 dia
104 // also, want to get pliers or tiny spanner in to do up locknut
105 hingescrew_nut_across = 3.92 + 0.25; // incl. slop around recess slop
106 hingescrew_nut_thick = 1.93;
107 hingescrew_head_th = 1.38 + 0.75;
108 hingescrew_head_dia = 3.92;
110 hingescrew_nut_recess_portion = 2/3; // portion of nut in recess
112 lever_cover_th = 0.75;
114 hingemount_wd = 4.8725;
119 button_l_fudge = 4.4;
120 buttonishleg_default_l_is_fudge = 10;
122 hinge_base_slope = 1.5; // bigger is steeper
124 strut_min_at_end = 1.5;
127 hinge_x_postscrew_gap = 0.75;
128 hinge_x_arms_gap = 0.35;
129 hinge_r_arms_gap = 0.55;
131 rearspeaker_gap = [ 2.0, 2.0 ]; // each side
135 catch_thickness = 1.0;
136 catch_side_gap = 0.75; // each side
140 catch_finger_height = 1.5;
141 catch_finger_depth = 2.5;
143 prop_recess_under = 0.50;
144 prop_recess_slop = 0.200; // each side
149 prop_side_gap = 0.75; // each side
150 prop_lidrecess_behind = 0.75;
151 prop_caserecess_behind = 0.75;
152 prop_caserecess_taper = 0.45; // one side only
154 prop_prong_heel_slope = 0.5;
156 // ---------- calculated ----------
158 phone_width = (phone + bumper*2)[0];
159 phone_height = (phone + bumper*2)[1];
161 inside_br = [phone_width, -phone_height];
163 prop_prong_h = prop_main_th;
165 //echo(camera_pos_tl + bumper,
166 // camera_pos_br + bumper);
168 // ----- could be changed -----
169 lid_buttoncover_gap = lid_gap_x;
170 lid_buttoncover_overlap = case_th_lip + keeper_gap_z_top;
172 phone_backside_slope_thick = phone_total_thick - phone_edge_thick;
174 //prop_lidrecess_depth = case_th_lid - prop_recess_under;
176 //prop_nose_len = case_th_lid - prop_recess_under;
177 //prop_recess_slope = tan(prop_max_angle); // bigger means steeper
178 //prop_recess_width = prop_main_th / cos(prop_max_angle) + prop_backfwd_gap;
181 //lid_lip_overlap_width xxx bad name = ;
182 //lid_lip_inner_slope = [ 5, 5 ]; // xxx
185 epp1 = [0, -phone_edge_thick];
186 epp2i = epp1 + phone_backside_slope_thick * [ phone_backside_slope_inner, -1 ];
187 epp2o = epp1 + phone_backside_slope_thick * [ phone_backside_slope_outer, -1 ];
188 epp3 = epp2i + [10, 0];
189 epp5 = epp0 + [0,1] * (keeper_th_z + keeper_gap_z_top + case_lip);
190 epp4 = epp5 + [-1,0] * case_th_side;
193 kppd = kppe + [1,0] * keeper_inner_width;
194 kppc = kppd + [0,1] * keeper_th_z;
195 kppb = [ kppe[0] - keeper_th_x, kppc[1] ];
196 kppf = kppe - [0,1] * keeper_inner_height;
197 kppa = [ kppb[0], kppf[1] ];
199 lpp10 = [ epp5[0] + lid_gap_x, kppc[1] + lid_gap_z ];
200 lpp11 = [ lpp10[0], epp5[1] + lid_gap_z ];
202 lpp14 = lpp10 + [1,0] * keeper_inner_width;
203 // exact x posn not very important; must extend past end of keeper
206 epp0[1] - phone_rim_depth + 1/2.5 * case_th_lid
207 + lid_screen_gap_extra ];
208 // ^ beam theory says to maximise force before contact,
209 // the gap below the `beam' (the lid) must be 1/3
210 // the thickness (ie the lid thickness) if the beam
211 // is solid, or 1/2 if it has a top and bottom only.
212 // ours is mostly solid.
214 lp_r12 = max(case_th_lid - (lpp11[1] - lpp15[1]),
217 lpp12 = [ epp4[0] + lp_r12, lpp11[1] ];
218 lpp13 = [ lpp12[0], lpp12[1] + lp_r12 ];
220 case_bottom_z = epp2o[1] - case_th_bottom;
224 bppN = [ 0.5 * (epp0[0] + epp4[0]), bppM[1] ];
225 bppR = [ bppN[0] + lid_buttoncover_gap, -button_cutout_depth ];
226 bppS = [ epp1[0], bppR[1] ];
227 bppQ = [ bppM[0], bppR[1] - lid_buttoncover_overlap ];
228 bppP = bppQ + [0,1] * lid_buttoncover_gap;
229 bppO = [ bppN[0], bppP[1] ];
230 bppL = lpp10 + [5,0];
231 bppK = [ bppL[0], bppN[1] ];
232 bppJ = [ bppN[0], bppL[1] ];
233 bppU = [ bppJ[0], lpp12[1] ];
237 // notification led aperture
239 nla_r0 = led_aperture/2;
240 nla_r1 = nla_r0 + led_window_ledge;
241 nla_r2 = nla_r1 + multicolour_gap;
243 led_window_style >= 3 ? initial_layer_thick :
244 led_window_style >= 2 ? led_window_ledge : 0;
248 hp_rn = hingescrew_nut_access_dia/2;
249 hp_r2_min = hp_rn + lever_cover_th;
250 hp_rs = hingescrew_shaft_dia/2;
251 hp_r1_min = hp_rs + hingemount_th;
253 hp_r1 = max(hp_r1_min, hp_r2_min);
257 hppS = epp2o + [0,-1] * case_th_bottom;
258 hp_k = 0.5 * (hppU[1] - hppS[1] + foldover_gap);
260 hppM = [ epp4[0] - foldover_lever_gap - hp_r2,
261 0.5 * (hppU + hppS)[1] ];
262 hppT = [ hppM[0], hppU[1] - hp_r1 ];
263 hppB = hppT + [0,-1] * hp_k;
265 hppE_y = epp2o[1] - case_th_bottom + hp_r1;
266 hppE_x = hppB[0] + (hppB[1] - hppE_y) * hinge_base_slope;
267 hppE = [ hppE_x, hppE_y ];
269 // hinge elevation x coords
271 hex20 = max(epp2o[0],
273 kppd[0] + hingescrew_head_th + keeper_gap_x_holes);
274 hex21 = hex20 + hingemount_wd;
275 hex22 = hex21 + hinge_x_gap;
276 hex27 = hex20 + hingescrew_shaft_len;
277 hex24 = hex27 + hinge_x_postscrew_gap;
278 hex23 = hex27 - (hingescrew_nut_thick*2
279 + hingescrew_fasteners_extra_thick);
280 hex26 = hex23 + hingescrew_nut_thick * 2/3;
282 echo(hex20, hex21, hex22, hex23, hex24);
283 // 6, 10.8725, 10.9975, 13.74, 18.75
284 module chk(act,exp) {
285 if (abs(act-exp) > 1e-9) echo("WRONG", act, exp);
286 else echo("ok", act);
296 cppJ = [ epp4[0] + catch_thickness, lpp10[1] ];
297 cppA = cppJ + [lid_gap_x, -lid_gap_z];
298 cppB = [ epp0[0], cppA[1] ];
299 cppP = [ epp4[0], cppJ[1] ];
301 cppS = cppJ + [0,-1] * catch_len;
302 cppD = [ cppA[0], cppS[1] + catch_slop ];
303 cppC = [ cppB[0], cppD[1] ];
304 cppT = cppS + [1,0] * catch_depth;
305 cppU = cppT + [0,-1] * catch_height;
306 cppV = [ cppS[0], cppU[1] - catch_depth ];
308 cppR = 0.5*(cppP + cppJ);
310 cp_rQ = 0.5 * (cppJ[0] - cppP[0]);
312 cppV[1] - (catch_finger_height - cp_rQ) ];
313 cppF = [ cppV[0] + catch_finger_depth, cppC[1] ];
315 // prop recess in case
317 prop_x_pos = phone_width/2;
319 prop_recess_hw = 0.5 * prop_main_width + prop_side_gap;
321 prc_r1 = prop_end_dia/2;
322 prc_r3 = prc_r1 + prop_recess_slop;
324 prcp2 = [ epp4[0] + prop_buildout_less,
327 prop_caserecess_buildout_r = -1; // prcp2[0] - epp2o[0];
329 prcp1 = [ epp2o[0] + prc_r3 + prop_caserecess_behind,
330 epp2i[1] - prc_r3 - prop_recess_under];
332 // prop recess in lid
334 prl_r10 = prop_end_dia/2;
335 prl_r10o = prl_r10 + prop_recess_slop;
337 prlp10 = lpp10 + [1,1] * prl_r10o
338 + [1,0] * prop_lidrecess_behind
339 + [0,1] * prop_recess_under;
344 $prpp11 = [0, prop_taper_len];
348 // ---------- modules ----------
350 module AdhocMultiprintFrame(phase, z0, zs) {
351 // from z0 to z0 + zs*layer
352 extra = phase * 0.65 + 5;
353 xextra = extra + -epp4[0];
354 xrange = [ 0, phone_width ] + [-1,+1] * xextra;
355 yextra = extra + -epp4[0];
356 yrange = [ -phone_height + +hppB[0] - hp_r2, 0 ] + [-1,+1] * yextra;
357 p0 = [ xrange[0], yrange[0] ];
358 p1 = [ xrange[1], yrange[1] ];
361 mirror([0,0, zs<0 ? 1 : 0])
362 linear_extrude(height= initial_layer_thick)
364 rectfromto(p0 - [1,1] * initial_layer_width,
365 p1 + [1,1] * initial_layer_width);
370 module KeeperProfile(slant=0){
371 use_e = kppe + [0,-1] * slant * keeper_inner_width / keeper_slant_slope;
372 polygon([use_e, kppd, kppc, kppb, kppa, kppf]);
375 module EdgeProfile(){
378 translate(epp3) square(case_th_bottom*2, center=true);
379 circleat(epp2o, r=case_th_bottom);
380 circleat(epp1, r=case_th_side);
381 rectfromto(epp0, epp4);
383 polygon([ epp5 + [0,10],
390 module LidEdgeProfile(){
401 circleat(lpp12, r=lp_r12);
402 rectfromto( lpp12 + [-10, 0],
403 lpp12 + [+10, +10] );
407 module ButtonCoverProfile(){
409 polygon(concat([ bppM, bppP, bppO, bppJ ],
410 (enable_support ? [ bppU, bppV, bppW ] : []),
419 module ButtonPlan(l, deep, cut){
421 (cut ? 0 : lid_buttoncover_gap);
424 (deep ? lid_buttoncover_overlap : 0);
426 C = [0,0]; // by definition
430 B0 = C + [0,-1] * button_cutout_depth;
431 B1 = B0 + [0,1] * epsilon;
433 r0 = 0.5 * (T[1] - B0[1]);
434 A = [ -(l + button_l_fudge)/2 + r0, 0.5 * (T[1] + B0[1]) ];
435 H = A + [0,-1] * delta;
441 E1 = E0 + [1,0] * epsilon;
443 I0 = [ E0[0], H[1] ];
444 I1 = [ E1[0], H[1] ];
447 for (m=[0,1]) mirror([m,0])
448 circleat(H, r0 - epsilon);
450 for (m=[0,1]) mirror([m,0]) {
460 circleat(D, r0 + epsilon);
465 module CatchCatchProfile(){
467 for (c=[ cppR, cppQ ])
471 circleat(lpp12, lp_r12);
472 circleat(lpp12 + [5,0], lp_r12);
473 rectfromto(cppP, cppP + [5,0.1]);
475 polygon([cppJ, cppS, cppT, cppU, cppV, cppQ, cppR]);
478 module CatchCutProfile(){
490 module Flip_rhs(yn=[0,1]) {
492 translate([phone_width/2, 0, 0])
493 mirror([$rhsflip,0,0])
494 translate([-phone_width/2, 0, 0])
499 module Flip_bot(yn=[0,1]) {
501 translate([0, -phone_height/2, 0])
502 mirror([0, $botflip, 0])
503 translate([0, phone_height/2, 0])
508 module AroundEdges(fill_zstart, fill_th, fill_downwards=0){
511 translate([0, -phone_cnr_rad, 0])
513 linear_extrude(height = phone_height - phone_cnr_rad*2)
517 Flip_rhs() Flip_bot() {
518 translate([+1,-1] * phone_cnr_rad)
523 translate([-1,0] * phone_cnr_rad)
525 rectfromto([0,-20],[10,20]);
527 translate([-10, 0, -20] + 0.01 * [+1,-1, 0] )
533 translate([ phone_width - phone_cnr_rad, 0,0 ])
535 linear_extrude(height = phone_width - phone_cnr_rad*2)
539 translate([0,0, fill_zstart])
540 mirror([0,0, fill_downwards])
541 linear_extrude(height = fill_th)
542 rectfromto([+1,-1] * phone_cnr_rad,
543 [phone_width, -phone_height] + [-1,+1] * phone_cnr_rad);
546 module CaseAperture(pos, dia, $fn) {
548 translate([ pos[0] + bumper[0],
551 rotate([-90, theta, 0])
552 cylinder(r = dia/2 / cos(theta),
556 module SideButton(y, y_ref_sign, l){
558 // +1 measured from top of actual phone to top of button
559 // -1 measured from bottom of actual phone to bottom of button
560 // 0 y is centre of button in coordinate system
562 eff_y = y_ref_sign > 0 ? -bumper [1] -y -l/2 :
563 y_ref_sign < 0 ? (-phone -bumper)[1] +y +l/2 :
566 translate([0, eff_y, 0])
570 module LidButtonishLeg(y, y_ref_sign, l=buttonishleg_default_l_is_fudge) {
571 $button_leg_only = true;
572 SideButton(y, y_ref_sign, l) children();
576 Flip_rhs(1) SideButton(15.580, +1, 8.9) children(); // power
577 Flip_rhs(1) SideButton(48.700, -1, 8.920) children(); // camera
578 Flip_rhs(0) SideButton(30.800, +1, 21.96) children(); // volume
579 Flip_rhs( ) LidButtonishLeg(14, -1) children();
580 // Flip_rhs(0) LidButtonishLeg(20, +1, 20) children();
583 module Struts(x_start, z_min, th){
584 // if th is negative, starts at z_min and works towards -ve z
585 // and object should then be printed other way up
586 for (i= [1 : 1 : case_struts_count]) {
590 mirror([0,0, th<0 ? 1 : 0])
592 -phone_height * i / (case_struts_count+1),
593 case_struts_solid_below])
594 linear_extrude(height= abs(th)
595 -(case_struts_solid_below+case_struts_solid_above))
596 rectfromto([ x_start, -0.5 * case_struts_width ],
597 [ phone_width - x_start, +0.5 * case_struts_width ]);
601 module OrdinaryRearAperture(rhs,bot, pos){
602 Flip_rhs(rhs) Flip_bot(bot)
605 translate(pos + bumper)
613 linextr(-epp2i[0], 60)
614 translate([0.5 * phone_width, 0, 0])
615 rectfromto([-microusb_width/2, epp2i[1] + microusb_below],
616 [+microusb_width/2, epp0[1] + -microusb_above]);
620 module OrdinaryRearApertures(){
622 OrdinaryRearAperture(1,1, rearspeaker_pos_bl)
623 rectfromto(-rearspeaker_gap,
624 rearspeaker_size + rearspeaker_gap);
626 // finger hole to remove phone
627 if (len(fingerpushhole_dias))
628 OrdinaryRearAperture(1,0, [ fingerpushhole_dias[0]/2 + epp2i[0],
630 scale(fingerpushhole_dias)
634 module RearCameraAperture(){
637 linear_extrude(height = 20)
640 rectfromto(camera_pos_tl, camera_pos_br);
643 module HingeLidProfile(){
645 circleat(hppT, hp_r1);
646 circleat(lpp12, lp_r12);
654 module HingeBaseProfile(){
657 circleat(hppB, hp_r1);
658 circleat(hppE, hp_r1);
659 circleat(epp2o, case_th_bottom);
660 circleat(hppB + [10,0], hp_r1);
662 polygon([epp5, epp1, epp2i, epp3, bppL]);
666 module HingeLeverOuterProfile(){
668 circleat(hppT, hp_r2);
669 circleat(hppB, hp_r2);
673 module HingeLeverInnerProfile(){
675 c = s > 0 ? hppT : hppB;
678 rotate(s<0 ? -40 : 0)
687 module HingeLeverNutProfile(){
688 for (c= [hppB, hppT]) {
690 circle($fn=6, r= 0.5 * hingescrew_nut_across / cos(30));
694 module Flip_hinge(doflip=1){
695 hinge_origin = [0, -(phone_height - hppB[0]), hppB[1]];
696 translate(hinge_origin)
697 rotate([doflip*180,0,0])
698 translate(-hinge_origin)
702 module HingePortion(x0,x1){
703 Flip_rhs() Flip_bot(1)
707 linear_extrude(height=x1-x0)
711 module CatchPortion(width){
712 translate([phone_width/2, 0,0])
714 linextr(-width/2, width/2)
719 AroundEdges(epp3[1], case_th_bottom, 1)
723 function prop_x(gamma) = hp_k / (2 * sin(gamma/2)) - hppT[0];
725 module PropProfileAssignments(gamma){
726 // https://en.wikipedia.org/wiki/Solution_of_triangles#Two_sides_and_the_included_angle_given_(SAS)
728 p = phone_height + prlp10[0] - hppB[0];
731 q = phone_height - hppT[0] - prcp1[0]; // $prpp7[0] is 0 by definition
733 c = sqrt(a*a + b*b - 2*a*b*cos(gamma));
734 $prp_alpha = acos( (b*b + c*c - a*a) / (2*b*c) );
736 $prp_theta = 90 - $prp_alpha;
737 beta = 180 - $prp_alpha - gamma;
740 //echo("abc", a,b,c);
742 v1 = [ [ cos(psi), -sin(psi) ], // x
743 [ sin(psi), cos(psi) ] ]; // y
745 $prpp7 = [0, c + (lpp13[1] - $prpp10[1] - hp_k) ];
748 $prp_r11 = prop_main_th/2;
750 $prpp1 = $prpp7 + [1,0] *
751 // this is approximate, but will do
752 (prop_main_th/2 + prop_prop_gap + prcp1[0] - cppA[0]);
755 v1[1] * ((prcp2[1] - prcp1[1]) - prop_prop_gap);
756 $prpp12 = $prpp3 + v1[0] *
757 (prop_end_dia + prop_caserecess_taper * ($prpp1[1] - $prpp3[1]));
758 $prp_r8 = prop_main_th;
759 $prpp4 = [ prop_main_th/2, $prpp3[1] ];
761 $prpp5 = [ $prpp12[0] - $prp_r5,
762 $prpp3[1] - prop_prong_h + $prp_r5 ];
763 $prpp6 = $prpp4 + [0,-1] * (prop_prong_h +
764 prop_prong_heel_slope * ($prpp5[0] - $prpp4[0]));
765 $prpp8 = $prpp4 + [0,-1] * $prp_r8;
766 $prpp9 = $prpp8 + [-1,0] * $prp_r8;
771 module PropProfile(gamma, cut=0, rot=0){ ////toplevel
772 PropProfileAssignments(gamma){
774 //#circleat($prpp3,1);
775 //#circleat($prpp12,1);
782 polygon([[-20,-0], [20,20], [0,0]]);
784 rectfromto($prpp6, $prpp9);
785 translate($prpp5) intersection(){
787 polygon([[-10,-10], [0,0], [10,0]]);
789 rectfromto($prpp12 + [0,-0.1], $prpp3);
792 circleat($prpp1, $prp_r1);
793 rectfromto($prpp12 + [0,-0.1], $prpp3);
797 rotate([0,0, rot*-$prp_theta]){
799 extra = cut ? prop_recess_slop : 0;
800 rectfromto($prpp6, $prpp9);
801 circleat($prpp11, $prp_r11 + extra);
802 circleat($prpp10, $prp_r10 + extra);
808 module PropAggregateProfile(){
809 for (angle = prop_angles)
810 PropProfile(angle, 0,0);
813 module Prop(){ ////toplevel
814 hw = prop_main_width/2;
816 PropAggregateProfile();
819 module Case(){ ////toplevel
824 // ledge (fixed keeper)
825 Flip_rhs(1-keeper_side) intersection(){
827 linear_extrude(height = phone_height + phone_cnr_rad * 2)
830 // outline of the whole case, to stop it protruding
831 translate([0,0, -25])
832 linear_extrude(height = 50)
835 circleat([+1,-1] * phone_cnr_rad, phone_cnr_rad + case_th_side/2);
839 HingePortion(hex20, hex21) HingeBaseProfile();
841 // buildout for prop recess
842 if (prop_caserecess_buildout_r > 0) Flip_rhs(1)
843 linextr(case_bottom_z, epp2i[1])
846 circleat([ prop_x_pos + dxs * prop_caserecess_buildout_r,
848 r = epp2o[0] - prcp2[0]);
853 Flip_rhs(keeper_side)
854 translate([0, -phone_cnr_rad, 0])
856 linear_extrude(height = phone_height + phone_cnr_rad * 2)
859 rectfromto([ -keeper_gap_x, -keeper_gap_z_bot ],
860 [ keeper_gap_x_holes, +keeper_gap_z_top ]);
864 RearCameraAperture();
866 // struts (invisible, because they're buried in the case)
867 Struts(epp2i[0], epp2i[1] - case_th_bottom, case_th_bottom);
872 if (!($button_leg_only && enable_support))
875 linear_extrude(height= 20)
876 ButtonPlan($button_l, 0,1);
877 if ($button_leg_only)
879 translate([phone_width/2, -400, kppe[1]])
880 mirror([1-abs($rhsflip - keeper_side),0,0])
881 cube([400, 800, 50]);
884 translate([-400, -400, kppd[1]])
888 translate([0,0, -bppR[0]])
889 linear_extrude(height= 20)
890 ButtonPlan($button_l, 1,1);
895 // apertures along top edge
896 CaseAperture(jack_pos, jack_dia, 8);
898 CaseAperture(noisecancelmic_pos, noisecancelmic_dia, 8);
900 OrdinaryRearApertures();
904 // gaps for the lid's hinge arms
905 HingePortion(hex20 - hinge_x_arms_gap,
906 hex21 + hinge_x_arms_gap)
909 circle(r= hinge_r_arms_gap, $fn= 8);
912 // screw holes in the hinge arms
916 CatchPortion(catch_width + catch_side_gap*2)
921 translate([prop_x_pos,0,0])
924 linextr(-prop_recess_hw, +prop_recess_hw)
926 for (d=[ [0,0], [0,-1], [+1,-1/prop_caserecess_taper] ])
927 circleat(prcp1 + 20*d,
933 module LidAdhocMultiprintFrame(phase){
934 if (led_window_style >= 3) {
935 AdhocMultiprintFrame(phase, lpp13[1], -1);
939 module Lid(){ ////toplevel
942 AroundEdges(lpp10[1], lpp13[1] - lpp10[1], 0)
950 linear_extrude(height= 20)
951 ButtonPlan($button_l, 1,0);
953 translate([0,0,-100])
954 linear_extrude(height= 200)
955 ButtonCoverProfile();
960 HingePortion(hex20, hex21) HingeLidProfile();
963 CatchPortion(catch_width)
966 Struts(lpp10[0] + strut_min_at_end, lpp13[1], -case_th_lid);
968 // screw holes in the hinge arms
972 translate([prop_x_pos, -prlp10[0], prlp10[1]])
975 linextr(-prop_recess_hw, +prop_recess_hw)
977 for (pa = prop_angles)
978 PropProfile(pa, 1,1);
980 // notification led aperture
981 if (led_window_style)
982 translate([led_pos[0], -led_pos[1], lpp13[1]]) {
984 cylinder(r=nla_r0, h=20);
985 if (led_window_style >= 2)
986 translate([0,0, -nla_t])
987 cylinder(r=nla_r2, height=20);
992 LidAdhocMultiprintFrame(1);
995 module HingeLever(){ ////toplevel
997 // outer body, positive
998 HingePortion(hex22, hex22 + phone_width/2)
999 HingeLeverOuterProfile();
1001 // space for the screws
1002 HingePortion(hex26, hex24)
1003 HingeLeverInnerProfile();
1005 // recesses for the nuts
1006 HingePortion(hex23, hex26+1)
1007 HingeLeverNutProfile();
1009 // bores for the screws
1012 // space for the charging cable
1014 Flip_hinge() MicroUSB();
1018 module LidWindow(){ ////toplevel
1019 translate([led_pos[0], -led_pos[1], lpp13[1]])
1021 cylinder(r= nla_r1, h=nla_t);
1022 LidAdhocMultiprintFrame(0, lpp13[1], -1);
1025 module LidWindowPrint(){ ////toplevel
1030 module DemoLidWindowSelect(){
1031 translate([led_pos[0], led_pos[1], -100]) {
1032 translate([0, -30, 0]) cube([400, 400, 200]);
1036 module DemoLidWindow(){ ////toplevel
1039 translate([0,40,0]){
1040 color("blue") intersection(){ Lid(); DemoLidWindowSelect(); }
1041 color("red") intersection(){ LidWindow(); DemoLidWindowSelect(); }
1045 module HingeLeverPrint(){ ////toplevel
1047 translate([-phone_width/2, phone_height, 0])
1051 module TestSelectLength(){
1052 translate([-30, -200, -20])
1053 cube([30 + 15, 250, 40]);
1056 module TestLength(){ ////toplevel
1063 module TestLengthRight(){ ////toplevel
1071 module TestSelectWidth(){
1072 translate([-30, -(phone_height - 25), -20])
1074 cube([200, 50, 40]);
1077 module TestWidth(){ ////toplevel
1084 module TestLidWidthPrint(){ ////toplevel
1085 rotate([0,180.0]) intersection(){
1091 module TestSelectRearAperture(){
1094 translate([20, 0,0])
1095 cube([42, 2, 1], center=true);
1099 module TestSelectCamera(){
1101 TestSelectRearAperture()
1102 RearCameraAperture();
1103 cube([0.1, 50, 0.1]);
1107 module TestSelectOrdinaryRearApertures(){
1108 TestSelectRearAperture()
1109 OrdinaryRearApertures();
1112 module TestCamera(){ ////toplevel
1119 module TestLidByCamera(){ ////toplevel
1126 module TestLidByCameraPrint(){ ////toplevel
1127 rotate([180,0,0]) TestLidByCamera();
1130 module DemoByCamera(){ ////toplevel
1131 color("blue") TestLidByCamera();
1132 color("red") TestCamera();
1135 module OneKeeper(){ ////toplevel
1136 translate([0, -phone_cnr_rad, 0])
1138 linear_extrude(height = phone_height - phone_cnr_rad * 2)
1142 module OneKeeperPrint(){ ////toplevel
1147 module LidPrint(){ ////toplevel
1152 module TestSelectFrame(){
1153 include = [1,-1] * (epp2i[0] + 4);
1156 cube(1000, center=true);
1157 translate([0,0, -100])
1158 linear_extrude(height=200)
1159 rectfromto(include, inside_br - include);
1163 module TestSelectLidFrame(){
1165 translate([led_pos[0], -led_pos[1], -50])
1166 cylinder(r= nla_r2+2, h=100);
1169 module TestFrameCase(){ ////toplevel
1175 TestSelectOrdinaryRearApertures();
1180 module TestTopApertures(){ ////toplevel
1184 translate([-100, -35, -100])
1185 cube([400, 100, 200]);
1189 module TestFrameLidPrint(){ ////toplevel
1190 rotate([0,180,0]) intersection(){
1192 TestSelectLidFrame();
1196 module ButtonPlanForDemo(z, deep, cut){
1198 ButtonPlan(8, deep, cut);
1201 module HingeScrews(){
1202 Flip_rhs() Flip_bot(1){
1203 for (c= [ hppT, hppB ])
1208 translate([0,0,-.2])
1209 cylinder( r= hingescrew_shaft_dia/2,
1210 h = hingescrew_shaft_len+0.2 );
1212 translate([0,0,+.1])
1213 cylinder( r= hingescrew_head_dia/2, h = hingescrew_head_th );
1218 module DemoPropAngleSelect(c){
1219 color(c) difference(){
1220 union(){ children(); }
1221 translate([ prop_x_pos, -400, -200 ])
1222 cube([ 400,800,400 ]);
1226 module DemoPropAngle(ang){
1227 hL = [0, -(phone_height - hppT[0]), hppT[1] - hp_k*2];
1228 hC = [0, -(phone_height - hppB[0]), hppB[1]];
1236 DemoPropAngleSelect("red") Case();
1239 translate([prop_x_pos, -prcp1[0], prcp1[1]])
1240 PropProfileAssignments(ang) {
1242 rotate([-$prp_theta, 0, 0])
1243 translate([0, $prpp1[0], -$prpp1[1]])
1249 translate([0,0, -hp_k*2])
1250 DemoPropAngleSelect("blue")
1254 module DemoPropAngles(){ ////toplevel
1255 for (i=[0 : len(prop_angles)-1])
1256 translate(i * [0, -100, 100])
1257 DemoPropAngle(prop_angles[i]);
1260 module DemoSelectAdhocLeftRight(right=0) {
1261 translate([phone_width/2, -400, -100]) // , -15, -100 to cross-section
1262 mirror([1-right, 0,0])
1263 cube([400, 800, 200]);
1266 module DemoLeft(){ ////toplevel
1267 color("red") intersection(){ Case(); DemoSelectAdhocLeftRight(); }
1268 color("blue") intersection(){ Lid(); DemoSelectAdhocLeftRight(); }
1271 module DemoFrame(){ ////toplevel
1272 color("red") TestFrameCase();
1273 color("blue") intersection(){ Lid(); TestSelectLidFrame(); }
1274 color("black") HingeScrews();
1278 module DemoHingedFrame(){ ///toplevel
1279 color("red") TestFrameCase();
1280 translate([0,0, -2*hp_k])
1281 color("blue") intersection(){ Lid(); TestSelectLidFrame(); }
1284 color("orange") HingeLever();
1285 color("black") HingeScrews();
1289 module DemoHinge(){ ////toplevel
1290 translate([ -0.5*phone_width, phone_height, hp_k*3 ]) {
1292 translate([0,0, -hp_k*3])
1297 module DemoProfiles(){ ////toplevel
1301 translate([0,0,-1]) color("black") KeeperProfile(1);
1307 demopoint_QR = [ bppS[0], bppQ[1] - 0.1];
1309 color("blue") ButtonCoverProfile();
1311 rectfromto(bppQ, demopoint_QR);
1312 rectfromto(bppR, demopoint_QR);
1316 translate([-20,0]) {
1317 color("black") ButtonPlanForDemo(-2, 0,1);
1318 color("red" ) ButtonPlanForDemo(-4, 1,1);
1319 color("blue") ButtonPlanForDemo(-6, 1,0);
1322 translate([0, -30]) {
1325 color("blue") HingeLidProfile();
1326 color("red") HingeBaseProfile();
1327 color("black") translate([0,0,-2]) HingeLeverOuterProfile();
1331 translate([-30, -60 + 30*f]) {
1332 translate([0,0,-4]) EdgeProfile();
1333 %translate([0,0,-10]) HingeBaseProfile();
1334 translate([0,-2] * f * hp_k) {
1335 translate([0,0,-4]) LidEdgeProfile();
1336 %translate([0,0,-10]) %HingeLidProfile();
1338 translate(+hppB) rotate([0,0,180*f]) translate(-hppB) {
1339 translate([0,0,-2]) color("black") HingeLeverOuterProfile();
1340 translate([0,0,0]) color("red") difference(){
1341 HingeLeverOuterProfile();
1342 HingeLeverInnerProfile();
1344 translate([0,0,3]) color("yellow") HingeLeverNutProfile();
1349 translate([20,-30]) {
1352 //translate([0,0,1]) CatchCutProfile();
1353 color("blue") CatchCatchProfile();
1354 color("red") difference(){ EdgeProfile(); CatchCutProfile(); }
1357 translate([40,-30]) {
1361 PropProfile(10, 1, 0);
1366 translate([60,-30]) {
1367 PropAggregateProfile();