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 button_cutout_depth = 9;
21 phone_edge_thick = 9.0;
22 phone_total_thick = 12.0;
23 phone_backside_slope_inner = 1.5; // larger means shallower
24 phone_backside_slope_outer = 1.0; // larger means shallower
26 camera_pos_tl = [ 6.450, 12.750 ]; // measured from tl corner
27 camera_pos_br = [ 22.300, 37.600 ]; // tl/br as seen from back
29 jack_pos = [ 13.83, 8.485 ];
30 jack_dia = 10.64 + .5; // some jack I had lying around
32 noisecancelmic_pos = [ 19.54, 7.37 ]; // from rhs
33 noisecancelmic_dia = 4.00;
35 //fingerpushhole_dias = [ 15, 18 ];
36 fingerpushhole_dias = [];
38 rearspeaker_pos_bl = [ 12.64, 18.72 ];
39 rearspeaker_size = [ 3.76, 7.36 ];
41 microusb_above = 3.27 - 0.25;
43 microusb_width = 16.12 + 1.25;
50 case_struts_count = 6;
51 case_struts_solid_below = 1.00;
52 case_struts_solid_above = 0.75;
53 case_struts_width = 0.10;
57 keeper_inner_width = 2.75;
58 keeper_inner_height = 2.75;
59 keeper_slant_slope = 2; // larger means steeper
61 keeper_gap_z_top = 0.25;
62 keeper_gap_z_bot = 0.75;
64 keeper_gap_x_holes = 0.75;
66 keeper_side = 0; // 0 = lhs; 1 = rhs
77 foldover_lever_gap = 0.50;
79 hingescrew_shaft_dia = 2.0 + 0.25; // M2 x 12mm machine screw
80 hingescrew_shaft_len = 12;
81 hingescrew_nut_thick = 1.93 + 0.20; // incl. washer
82 hingescrew_nut_access_dia = 4.72 + 0.50;
83 // ^ washer is 4.72 dia
84 // also, want to get pliers or tiny spanner in to do up locknut
85 hingescrew_nut_across = 3.92 + 0.25; // incl. slop around recess slop
86 hingescrew_nut_thick_real = 1.93;
87 hingescrew_head_th = 1.38 + 0.75;
88 hingescrew_head_dia = 3.92;
89 lever_cover_th = 0.75;
92 hingescrew_nut_recess_portion = 2/3; // portion of nut in recess
98 buttonishleg_default_l_is_fudge = 10;
100 hinge_base_slope = 1.5; // bigger is steeper
102 strut_min_at_end = 1.5;
105 hinge_x_postscrew_gap = 0.75;
106 hinge_x_arms_gap = 0.35;
107 hinge_r_arms_gap = 0.55;
109 rearspeaker_gap = [ 2.0, 2.0 ]; // each side
113 catch_thickness = 1.0;
114 catch_side_gap = 0.75; // each side
118 catch_finger_height = 1.5;
119 catch_finger_depth = 2.5;
121 prop_recess_under = 0.50;
122 prop_recess_slop = 0.200; // each side
127 prop_side_gap = 0.75; // each side
128 prop_lidrecess_behind = 0.75;
129 prop_caserecess_behind = 0.75;
130 prop_caserecess_taper = 0.45; // one side only
132 prop_prong_heel_slope = 0.5;
134 // ---------- calculated ----------
136 phone_width = (phone + bumper*2)[0];
137 phone_height = (phone + bumper*2)[1];
139 inside_br = [phone_width, -phone_height];
141 prop_prong_h = prop_main_th;
143 //echo(camera_pos_tl + bumper,
144 // camera_pos_br + bumper);
146 // ----- could be changed -----
147 lid_buttoncover_gap = lid_gap_x;
148 lid_buttoncover_overlap = case_th_lip + keeper_gap_z_top;
150 phone_backside_slope_thick = phone_total_thick - phone_edge_thick;
152 //prop_lidrecess_depth = case_th_lid - prop_recess_under;
154 //prop_nose_len = case_th_lid - prop_recess_under;
155 //prop_recess_slope = tan(prop_max_angle); // bigger means steeper
156 //prop_recess_width = prop_main_th / cos(prop_max_angle) + prop_backfwd_gap;
159 //lid_lip_overlap_width xxx bad name = ;
160 //lid_lip_inner_slope = [ 5, 5 ]; // xxx
163 epp1 = [0, -phone_edge_thick];
164 epp2i = epp1 + phone_backside_slope_thick * [ phone_backside_slope_inner, -1 ];
165 epp2o = epp1 + phone_backside_slope_thick * [ phone_backside_slope_outer, -1 ];
166 epp3 = epp2i + [10, 0];
167 epp5 = epp0 + [0,1] * (keeper_th_z + keeper_gap_z_top + case_lip);
168 epp4 = epp5 + [-1,0] * case_th_side;
171 kppd = kppe + [1,0] * keeper_inner_width;
172 kppc = kppd + [0,1] * keeper_th_z;
173 kppb = [ kppe[0] - keeper_th_x, kppc[1] ];
174 kppf = kppe - [0,1] * keeper_inner_height;
175 kppa = [ kppb[0], kppf[1] ];
177 lpp10 = [ epp5[0] + lid_gap_x, kppc[1] + lid_gap_z ];
178 lpp11 = [ lpp10[0], epp5[1] + lid_gap_z ];
180 lp_r12 = case_th_lid - (lpp11[1] - lpp10[1]);
182 lpp12 = [ epp4[0] + lp_r12, lpp11[1] ];
183 lpp13 = [ lpp12[0], lpp12[1] + lp_r12 ];
185 case_bottom_z = epp2o[1] - case_th_bottom;
189 bppN = [ 0.5 * (epp0[0] + epp4[0]), bppM[1] ];
190 bppR = [ bppN[0] + lid_buttoncover_gap, -button_cutout_depth ];
191 bppS = [ epp1[0], bppR[1] ];
192 bppQ = [ bppM[0], bppR[1] - lid_buttoncover_overlap ];
193 bppP = bppQ + [0,1] * lid_buttoncover_gap;
194 bppO = [ bppN[0], bppP[1] ];
195 bppL = lpp10 + [5,0];
196 bppK = [ bppL[0], bppN[1] ];
197 bppJ = [ bppN[0], bppL[1] ];
198 bppU = [ bppJ[0], lpp12[1] ];
203 hp_rn = hingescrew_nut_access_dia/2;
204 hp_r2_min = hp_rn + lever_cover_th;
205 hp_rs = hingescrew_shaft_dia/2;
206 hp_r1_min = hp_rs + hingemount_th;
208 hp_r1 = max(hp_r1_min, hp_r2_min);
212 hppS = epp2o + [0,-1] * case_th_bottom;
213 hp_k = 0.5 * (hppU[1] - hppS[1] + foldover_gap);
215 hppM = [ epp4[0] - foldover_lever_gap - hp_r2,
216 0.5 * (hppU + hppS)[1] ];
217 hppT = [ hppM[0], hppU[1] - hp_r1 ];
218 hppB = hppT + [0,-1] * hp_k;
220 hppE_y = epp2o[1] - case_th_bottom + hp_r1;
221 hppE_x = hppB[0] + (hppB[1] - hppE_y) * hinge_base_slope;
222 hppE = [ hppE_x, hppE_y ];
224 // hinge elevation x coords
226 hingescrew_portion_len =
227 0.5* (hingescrew_shaft_len - hingescrew_nut_thick - hinge_x_gap);
229 hex20 = max(epp2o[0],
231 kppd[0] + hingescrew_head_th + keeper_gap_x_holes);
232 hex21 = hex20 + hingescrew_portion_len;
233 hex22 = hex21 + hinge_x_gap;
234 hex23 = hex22 + hingescrew_portion_len
235 - hingescrew_nut_thick; // bodge, need to divvy this up more sensibly
236 hex26 = hex23 + hingescrew_nut_thick_real * 2/3;
237 hex24 = hex20 + hingescrew_shaft_len + hinge_x_postscrew_gap;
238 //echo(hex20, hex21, hex22, hex23, hex24);
239 //echo(hingescrew_portion_len);
243 cppJ = [ epp4[0] + catch_thickness, lpp10[1] ];
244 cppA = cppJ + [lid_gap_x, -lid_gap_z];
245 cppB = [ epp0[0], cppA[1] ];
246 cppP = [ epp4[0], cppJ[1] ];
248 cppS = cppJ + [0,-1] * catch_len;
249 cppD = [ cppA[0], cppS[1] + catch_slop ];
250 cppC = [ cppB[0], cppD[1] ];
251 cppT = cppS + [1,0] * catch_depth;
252 cppU = cppT + [0,-1] * catch_height;
253 cppV = [ cppS[0], cppU[1] - catch_depth ];
255 cppR = 0.5*(cppP + cppJ);
257 cp_rQ = 0.5 * (cppJ[0] - cppP[0]);
259 cppV[1] - (catch_finger_height - cp_rQ) ];
260 cppF = [ cppV[0] + catch_finger_depth, cppC[1] ];
262 // prop recess in case
264 prop_x_pos = phone_width/2;
266 prop_recess_hw = 0.5 * prop_main_width + prop_side_gap;
268 prc_r1 = prop_end_dia/2;
269 prc_r3 = prc_r1 + prop_recess_slop;
271 prcp2 = [ epp4[0] + prop_buildout_less,
274 prop_caserecess_buildout_r = -1; // prcp2[0] - epp2o[0];
276 prcp1 = [ epp2o[0] + prc_r3 + prop_caserecess_behind,
277 epp2i[1] - prc_r3 - prop_recess_under];
279 // prop recess in lid
281 prl_r10 = prop_end_dia/2;
282 prl_r10o = prl_r10 + prop_recess_slop;
284 prlp10 = lpp10 + [1,1] * prl_r10o
285 + [1,0] * prop_lidrecess_behind
286 + [0,1] * prop_recess_under;
291 $prpp11 = [0, prop_taper_len];
295 // ---------- modules ----------
297 module KeeperProfile(slant=0){
298 use_e = kppe + [0,-1] * slant * keeper_inner_width / keeper_slant_slope;
299 polygon([use_e, kppd, kppc, kppb, kppa, kppf]);
302 module EdgeProfile(){
305 translate(epp3) square(case_th_bottom*2, center=true);
306 circleat(epp2o, r=case_th_bottom);
307 circleat(epp1, r=case_th_side);
308 rectfromto(epp0, epp4);
310 polygon([ epp5 + [0,10],
317 module LidEdgeProfile(){
326 circleat(lpp12, r=lp_r12);
327 rectfromto( lpp12 + [-10, 0],
328 lpp12 + [+10, +10] );
332 module ButtonCoverProfile(){
334 polygon(concat([ bppM, bppP, bppO, bppJ ],
335 (enable_support ? [ bppU, bppV, bppW ] : []),
344 module ButtonPlan(l, deep, cut){
346 (cut ? 0 : lid_buttoncover_gap);
349 (deep ? lid_buttoncover_overlap : 0);
351 C = [0,0]; // by definition
355 B0 = C + [0,-1] * button_cutout_depth;
356 B1 = B0 + [0,1] * epsilon;
358 r0 = 0.5 * (T[1] - B0[1]);
359 A = [ -(l + button_l_fudge)/2 + r0, 0.5 * (T[1] + B0[1]) ];
360 H = A + [0,-1] * delta;
366 E1 = E0 + [1,0] * epsilon;
368 I0 = [ E0[0], H[1] ];
369 I1 = [ E1[0], H[1] ];
372 for (m=[0,1]) mirror([m,0])
373 circleat(H, r0 - epsilon);
375 for (m=[0,1]) mirror([m,0]) {
385 circleat(D, r0 + epsilon);
390 module CatchCatchProfile(){
392 for (c=[ cppR, cppQ ])
396 circleat(lpp12, lp_r12);
397 circleat(lpp12 + [5,0], lp_r12);
398 rectfromto(cppP, cppP + [5,0.1]);
400 polygon([cppJ, cppS, cppT, cppU, cppV, cppQ, cppR]);
403 module CatchCutProfile(){
415 module Flip_rhs(yn=[0,1]) {
417 translate([phone_width/2, 0, 0])
418 mirror([$rhsflip,0,0])
419 translate([-phone_width/2, 0, 0])
424 module Flip_bot(yn=[0,1]) {
426 translate([0, -phone_height/2, 0])
427 mirror([0, $botflip, 0])
428 translate([0, phone_height/2, 0])
433 module AroundEdges(fill_zstart, fill_th, fill_downwards=0){
436 translate([0, -phone_cnr_rad, 0])
438 linear_extrude(height = phone_height - phone_cnr_rad*2)
442 Flip_rhs() Flip_bot() {
443 translate([+1,-1] * phone_cnr_rad)
448 translate([-1,0] * phone_cnr_rad)
450 rectfromto([0,-20],[10,20]);
452 translate([-10, 0, -20] + 0.01 * [+1,-1, 0] )
458 translate([ phone_width - phone_cnr_rad, 0,0 ])
460 linear_extrude(height = phone_width - phone_cnr_rad*2)
464 translate([0,0, fill_zstart])
465 mirror([0,0, fill_downwards])
466 linear_extrude(height = fill_th)
467 rectfromto([+1,-1] * phone_cnr_rad,
468 [phone_width, -phone_height] + [-1,+1] * phone_cnr_rad);
471 module CaseAperture(pos, dia, $fn) {
473 translate([ pos[0] + bumper[0],
476 rotate([-90, theta, 0])
477 cylinder(r = dia/2 / cos(theta),
481 module SideButton(y, y_ref_sign, l){
483 // +1 measured from top of actual phone to top of button
484 // -1 measured from bottom of actual phone to bottom of button
485 // 0 y is centre of button in coordinate system
487 eff_y = y_ref_sign > 0 ? -bumper [1] -y -l/2 :
488 y_ref_sign < 0 ? (-phone -bumper)[1] +y +l/2 :
491 translate([0, eff_y, 0])
495 module LidButtonishLeg(y, y_ref_sign, l=buttonishleg_default_l_is_fudge) {
496 $button_leg_only = true;
497 SideButton(y, y_ref_sign, l) children();
501 Flip_rhs(1) SideButton(15.580, +1, 8.9) children(); // power
502 Flip_rhs(1) SideButton(48.700, -1, 8.920) children(); // camera
503 Flip_rhs(0) SideButton(30.800, +1, 21.96) children(); // volume
504 Flip_rhs( ) LidButtonishLeg(14, -1) children();
505 // Flip_rhs(0) LidButtonishLeg(20, +1, 20) children();
508 module Struts(x_start, z_min, th){
509 // if th is negative, starts at z_min and works towards -ve z
510 // and object should then be printed other way up
511 for (i= [1 : 1 : case_struts_count]) {
515 mirror([0,0, th<0 ? 1 : 0])
517 -phone_height * i / (case_struts_count+1),
518 case_struts_solid_below])
519 linear_extrude(height= abs(th)
520 -(case_struts_solid_below+case_struts_solid_above))
521 rectfromto([ x_start, -0.5 * case_struts_width ],
522 [ phone_width - x_start, +0.5 * case_struts_width ]);
526 module OrdinaryRearAperture(rhs,bot, pos){
527 Flip_rhs(rhs) Flip_bot(bot)
530 translate(pos + bumper)
538 linextr(-epp2i[0], 60)
539 translate([0.5 * phone_width, 0, 0])
540 rectfromto([-microusb_width/2, epp2i[1] + microusb_below],
541 [+microusb_width/2, epp0[1] + -microusb_above]);
545 module OrdinaryRearApertures(){
547 OrdinaryRearAperture(1,1, rearspeaker_pos_bl)
548 rectfromto(-rearspeaker_gap,
549 rearspeaker_size + rearspeaker_gap);
551 // finger hole to remove phone
552 if (len(fingerpushhole_dias))
553 OrdinaryRearAperture(1,0, [ fingerpushhole_dias[0]/2 + epp2i[0],
555 scale(fingerpushhole_dias)
559 module RearCameraAperture(){
562 linear_extrude(height = 20)
565 rectfromto(camera_pos_tl, camera_pos_br);
568 module HingeLidProfile(){
570 circleat(hppT, hp_r1);
571 circleat(lpp12, lp_r12);
579 module HingeBaseProfile(){
582 circleat(hppB, hp_r1);
583 circleat(hppE, hp_r1);
584 circleat(epp2o, case_th_bottom);
585 circleat(hppB + [10,0], hp_r1);
587 polygon([epp5, epp1, epp2i, epp3, bppL]);
591 module HingeLeverOuterProfile(){
593 circleat(hppT, hp_r2);
594 circleat(hppB, hp_r2);
598 module HingeLeverInnerProfile(){
600 c = s > 0 ? hppT : hppB;
603 rotate(s<0 ? -40 : 0)
612 module HingeLeverNutProfile(){
613 for (c= [hppB, hppT]) {
615 circle($fn=6, r= 0.5 * hingescrew_nut_across / cos(30));
619 module Flip_hinge(doflip=1){
620 hinge_origin = [0, -(phone_height - hppB[0]), hppB[1]];
621 translate(hinge_origin)
622 rotate([doflip*180,0,0])
623 translate(-hinge_origin)
627 module HingePortion(x0,x1){
628 Flip_rhs() Flip_bot(1)
632 linear_extrude(height=x1-x0)
636 module CatchPortion(width){
637 translate([phone_width/2, 0,0])
639 linextr(-width/2, width/2)
644 AroundEdges(epp3[1], case_th_bottom, 1)
648 function prop_x(gamma) = hp_k / (2 * sin(gamma/2)) - hppT[0];
650 module PropProfileAssignments(gamma){
651 // https://en.wikipedia.org/wiki/Solution_of_triangles#Two_sides_and_the_included_angle_given_(SAS)
653 p = phone_height + prlp10[0] - hppB[0];
656 q = phone_height - hppT[0] - prcp1[0]; // $prpp7[0] is 0 by definition
658 c = sqrt(a*a + b*b - 2*a*b*cos(gamma));
659 $prp_alpha = acos( (b*b + c*c - a*a) / (2*b*c) );
661 $prp_theta = 90 - $prp_alpha;
662 beta = 180 - $prp_alpha - gamma;
665 //echo("abc", a,b,c);
667 v1 = [ [ cos(psi), -sin(psi) ], // x
668 [ sin(psi), cos(psi) ] ]; // y
670 $prpp7 = [0, c + (lpp13[1] - $prpp10[1] - hp_k) ];
673 $prp_r11 = prop_main_th/2;
675 $prpp1 = $prpp7 + [1,0] *
676 // this is approximate, but will do
677 (prop_main_th/2 + prop_prop_gap + prcp1[0] - cppA[0]);
680 v1[1] * ((prcp2[1] - prcp1[1]) - prop_prop_gap);
681 $prpp12 = $prpp3 + v1[0] *
682 (prop_end_dia + prop_caserecess_taper * ($prpp1[1] - $prpp3[1]));
683 $prp_r8 = prop_main_th;
684 $prpp4 = [ prop_main_th/2, $prpp3[1] ];
686 $prpp5 = [ $prpp12[0] - $prp_r5,
687 $prpp3[1] - prop_prong_h + $prp_r5 ];
688 $prpp6 = $prpp4 + [0,-1] * (prop_prong_h +
689 prop_prong_heel_slope * ($prpp5[0] - $prpp4[0]));
690 $prpp8 = $prpp4 + [0,-1] * $prp_r8;
691 $prpp9 = $prpp8 + [-1,0] * $prp_r8;
696 module PropProfile(gamma, cut=0, rot=0){ ////toplevel
697 PropProfileAssignments(gamma){
699 //#circleat($prpp3,1);
700 //#circleat($prpp12,1);
707 polygon([[-20,-0], [20,20], [0,0]]);
709 rectfromto($prpp6, $prpp9);
710 translate($prpp5) intersection(){
712 polygon([[-10,-10], [0,0], [10,0]]);
714 rectfromto($prpp12 + [0,-0.1], $prpp3);
717 circleat($prpp1, $prp_r1);
718 rectfromto($prpp12 + [0,-0.1], $prpp3);
722 rotate([0,0, rot*-$prp_theta]){
724 extra = cut ? prop_recess_slop : 0;
725 rectfromto($prpp6, $prpp9);
726 circleat($prpp11, $prp_r11 + extra);
727 circleat($prpp10, $prp_r10 + extra);
733 module PropAggregateProfile(){
734 for (angle = prop_angles)
735 PropProfile(angle, 0,0);
738 module Prop(){ ////toplevel
739 hw = prop_main_width/2;
741 PropAggregateProfile();
744 module Case(){ ////toplevel
749 // ledge (fixed keeper)
750 Flip_rhs(1-keeper_side) intersection(){
752 linear_extrude(height = phone_height + phone_cnr_rad * 2)
755 // outline of the whole case, to stop it protruding
756 translate([0,0, -25])
757 linear_extrude(height = 50)
760 circleat([+1,-1] * phone_cnr_rad, phone_cnr_rad + case_th_side/2);
764 HingePortion(hex20, hex21) HingeBaseProfile();
766 // buildout for prop recess
767 if (prop_caserecess_buildout_r > 0) Flip_rhs(1)
768 linextr(case_bottom_z, epp2i[1])
771 circleat([ prop_x_pos + dxs * prop_caserecess_buildout_r,
773 r = epp2o[0] - prcp2[0]);
778 Flip_rhs(keeper_side)
779 translate([0, -phone_cnr_rad, 0])
781 linear_extrude(height = phone_height + phone_cnr_rad * 2)
784 rectfromto([ -keeper_gap_x, -keeper_gap_z_bot ],
785 [ keeper_gap_x_holes, +keeper_gap_z_top ]);
789 RearCameraAperture();
791 // struts (invisible, because they're buried in the case)
792 Struts(epp2i[0], epp2i[1] - case_th_bottom, case_th_bottom);
797 if (!($button_leg_only && enable_support))
800 linear_extrude(height= 20)
801 ButtonPlan($button_l, 0,1);
802 if ($button_leg_only)
804 translate([phone_width/2, -400, kppe[1]])
805 mirror([1-abs($rhsflip - keeper_side),0,0])
806 cube([400, 800, 50]);
809 translate([-400, -400, kppd[1]])
813 translate([0,0, -bppR[0]])
814 linear_extrude(height= 20)
815 ButtonPlan($button_l, 1,1);
820 // apertures along top edge
821 CaseAperture(jack_pos, jack_dia, 8);
823 CaseAperture(noisecancelmic_pos, noisecancelmic_dia, 8);
825 OrdinaryRearApertures();
829 // gaps for the lid's hinge arms
830 HingePortion(hex20 - hinge_x_arms_gap,
831 hex21 + hinge_x_arms_gap)
834 circle(r= hinge_r_arms_gap, $fn= 8);
837 // screw holes in the hinge arms
841 CatchPortion(catch_width + catch_side_gap*2)
846 translate([prop_x_pos,0,0])
849 linextr(-prop_recess_hw, +prop_recess_hw)
851 for (d=[ [0,0], [0,-1], [+1,-1/prop_caserecess_taper] ])
852 circleat(prcp1 + 20*d,
858 module Lid(){ ////toplevel
861 AroundEdges(lpp10[1], lpp13[1] - lpp10[1], 0)
869 linear_extrude(height= 20)
870 ButtonPlan($button_l, 1,0);
872 translate([0,0,-100])
873 linear_extrude(height= 200)
874 ButtonCoverProfile();
879 HingePortion(hex20, hex21) HingeLidProfile();
882 CatchPortion(catch_width)
885 Struts(lpp10[0] + strut_min_at_end, lpp13[1], -case_th_lid);
887 // screw holes in the hinge arms
891 translate([prop_x_pos, -prlp10[0], prlp10[1]])
894 linextr(-prop_recess_hw, +prop_recess_hw)
896 for (pa = prop_angles)
897 PropProfile(pa, 1,1);
901 module HingeLever(){ ////toplevel
903 // outer body, positive
904 HingePortion(hex22, hex22 + phone_width/2)
905 HingeLeverOuterProfile();
907 // space for the screws
908 HingePortion(hex26, hex24)
909 HingeLeverInnerProfile();
911 // recesses for the nuts
912 HingePortion(hex23, hex26+1)
913 HingeLeverNutProfile();
915 // bores for the screws
918 // space for the charging cable
920 Flip_hinge() MicroUSB();
924 module HingeLeverPrint(){ ////toplevel
926 translate([-phone_width/2, phone_height, 0])
930 module TestSelectLength(){
931 translate([-30, -200, -20])
932 cube([30 + 15, 250, 40]);
935 module TestLength(){ ////toplevel
942 module TestLengthRight(){ ////toplevel
950 module TestSelectWidth(){
951 translate([-30, -(phone_height - 25), -20])
956 module TestWidth(){ ////toplevel
963 module TestLidWidthPrint(){ ////toplevel
964 rotate([0,180.0]) intersection(){
970 module TestSelectRearAperture(){
974 cube([42, 2, 1], center=true);
978 module TestSelectCamera(){
980 TestSelectRearAperture()
981 RearCameraAperture();
982 cube([0.1, 50, 0.1]);
986 module TestSelectOrdinaryRearApertures(){
987 TestSelectRearAperture()
988 OrdinaryRearApertures();
991 module TestCamera(){ ////toplevel
998 module TestLidByCamera(){ ////toplevel
1005 module TestLidByCameraPrint(){ ////toplevel
1006 rotate([180,0,0]) TestLidByCamera();
1009 module DemoByCamera(){ ////toplevel
1010 color("blue") TestLidByCamera();
1011 color("red") TestCamera();
1014 module OneKeeper(){ ////toplevel
1015 translate([0, -phone_cnr_rad, 0])
1017 linear_extrude(height = phone_height - phone_cnr_rad * 2)
1021 module OneKeeperPrint(){ ////toplevel
1026 module LidPrint(){ ////toplevel
1031 module TestSelectFrame(){
1032 include = [1,-1] * (epp2i[0] + 4);
1035 cube(1000, center=true);
1036 translate([0,0, -100])
1037 linear_extrude(height=200)
1038 rectfromto(include, inside_br - include);
1042 module TestSelectLidFrame(){
1046 module TestFrameCase(){ ////toplevel
1052 TestSelectOrdinaryRearApertures();
1057 module TestTopApertures(){ ////toplevel
1061 translate([-100, -35, -100])
1062 cube([400, 100, 200]);
1066 module TestFrameLidPrint(){ ////toplevel
1067 rotate([0,180,0]) intersection(){
1069 TestSelectLidFrame();
1073 module ButtonPlanForDemo(z, deep, cut){
1075 ButtonPlan(8, deep, cut);
1078 module HingeScrews(){
1079 Flip_rhs() Flip_bot(1){
1080 for (c= [ hppT, hppB ])
1085 translate([0,0,-.2])
1086 cylinder( r= hingescrew_shaft_dia/2,
1087 h = hingescrew_shaft_len+0.2 );
1089 translate([0,0,+.1])
1090 cylinder( r= hingescrew_head_dia/2, h = hingescrew_head_th );
1095 module DemoPropAngleSelect(c){
1096 color(c) difference(){
1097 union(){ children(); }
1098 translate([ prop_x_pos, -400, -200 ])
1099 cube([ 400,800,400 ]);
1103 module DemoPropAngle(ang){
1104 hL = [0, -(phone_height - hppT[0]), hppT[1] - hp_k*2];
1105 hC = [0, -(phone_height - hppB[0]), hppB[1]];
1113 DemoPropAngleSelect("red") Case();
1116 translate([prop_x_pos, -prcp1[0], prcp1[1]])
1117 PropProfileAssignments(ang) {
1119 rotate([-$prp_theta, 0, 0])
1120 translate([0, $prpp1[0], -$prpp1[1]])
1126 translate([0,0, -hp_k*2])
1127 DemoPropAngleSelect("blue")
1131 module DemoPropAngles(){ ////toplevel
1132 for (i=[0 : len(prop_angles)-1])
1133 translate(i * [0, -100, 100])
1134 DemoPropAngle(prop_angles[i]);
1137 module DemoFrame(){ ////toplevel
1138 color("red") TestFrameCase();
1139 color("blue") intersection(){ Lid(); TestSelectLidFrame(); }
1140 color("black") HingeScrews();
1144 module DemoHingedFrame(){ ///toplevel
1145 color("red") TestFrameCase();
1146 translate([0,0, -2*hp_k])
1147 color("blue") intersection(){ Lid(); TestSelectLidFrame(); }
1150 color("orange") HingeLever();
1151 color("black") HingeScrews();
1155 module DemoHinge(){ ////toplevel
1157 translate([0,0, -hp_k*3])
1161 module DemoProfiles(){ ////toplevel
1165 translate([0,0,-1]) color("black") KeeperProfile(1);
1171 demopoint_QR = [ bppS[0], bppQ[1] - 0.1];
1173 color("blue") ButtonCoverProfile();
1175 rectfromto(bppQ, demopoint_QR);
1176 rectfromto(bppR, demopoint_QR);
1180 translate([-20,0]) {
1181 color("black") ButtonPlanForDemo(-2, 0,1);
1182 color("red" ) ButtonPlanForDemo(-4, 1,1);
1183 color("blue") ButtonPlanForDemo(-6, 1,0);
1186 translate([0, -30]) {
1189 color("blue") HingeLidProfile();
1190 color("red") HingeBaseProfile();
1191 color("black") translate([0,0,-2]) HingeLeverOuterProfile();
1195 translate([-30, -60 + 30*f]) {
1196 translate([0,0,-4]) EdgeProfile();
1197 %translate([0,0,-10]) HingeBaseProfile();
1198 translate([0,-2] * f * hp_k) {
1199 translate([0,0,-4]) LidEdgeProfile();
1200 %translate([0,0,-10]) %HingeLidProfile();
1202 translate(+hppB) rotate([0,0,180*f]) translate(-hppB) {
1203 translate([0,0,-2]) color("black") HingeLeverOuterProfile();
1204 translate([0,0,0]) color("red") difference(){
1205 HingeLeverOuterProfile();
1206 HingeLeverInnerProfile();
1208 translate([0,0,3]) color("yellow") HingeLeverNutProfile();
1213 translate([20,-30]) {
1216 //translate([0,0,1]) CatchCutProfile();
1217 color("blue") CatchCatchProfile();
1218 color("red") difference(){ EdgeProfile(); CatchCutProfile(); }
1221 translate([40,-30]) {
1225 PropProfile(10, 1, 0);
1230 translate([60,-30]) {
1231 PropAggregateProfile();