+module CaseAperture(pos, dia, $fn) {
+ theta = 180/$fn;
+ translate([ pos[0] + bumper[0],
+ -epp2i[0],
+ -pos[1] ])
+ rotate([-90, theta, 0])
+ cylinder(r = dia/2 / cos(theta),
+ h = 60);
+}
+
+module SideButton(y, y_ref_sign, l){
+ // y_ref_sign:
+ // +1 measured from top of actual phone to top of button
+ // -1 measured from bottom of actual phone to bottom of button
+ // 0 y is centre of button in coordinate system
+ $button_l= l;
+ eff_y = y_ref_sign > 0 ? -bumper [1] -y -l/2 :
+ y_ref_sign < 0 ? (-phone -bumper)[1] +y +l/2 :
+ y;
+ echo(eff_y);
+ translate([0, eff_y, 0])
+ children();
+}
+
+module LidButtonishLeg(y, y_ref_sign, l=buttonishleg_default_l_is_fudge) {
+ $button_leg_only = true;
+ SideButton(y, y_ref_sign, l) children();
+}
+
+module Buttons(){
+ CaseBase_rhsflip([1]) SideButton(15.580, +1, 8.9) children(); // power
+ CaseBase_rhsflip([1]) SideButton(48.700, -1, 8.920) children(); // camera
+ CaseBase_rhsflip([0]) SideButton(30.800, +1, 21.96) children(); // volume
+ CaseBase_rhsflip( ) LidButtonishLeg(20, -1) children();
+// CaseBase_rhsflip([0]) LidButtonishLeg(20, +1, 20) children();
+}
+
+module Struts(x_start, z_min, th){
+ // if th is negative, starts at z_min and works towards -ve z
+ // and object should then be printed other way up
+ for (i= [1 : 1 : case_struts_count]) {
+ translate([0,
+ 0,
+ z_min])
+ mirror([0,0, th<0 ? 1 : 0])
+ translate([0,
+ -phone_height * i / (case_struts_count+1),
+ case_struts_solid_below])
+ linear_extrude(height= abs(th)
+ -(case_struts_solid_below+case_struts_solid_above))
+ rectfromto([ x_start, -0.5 * case_struts_width ],
+ [ phone_width - x_start, +0.5 * case_struts_width ]);
+ }
+}
+
+module OrdinaryRearAperture(rhs,bot, pos){
+ CaseBase_rhsflip(rhs) CaseBase_botflip(bot)
+ linextr(-20, 20)
+ mirror([0,1])
+ translate(pos + bumper)
+ children();
+}
+
+module OrdinaryRearApertures(){
+ // rear speaker
+ OrdinaryRearAperture(1,1, rearspeaker_pos_bl)
+ rectfromto(-rearspeaker_gap,
+ rearspeaker_size + rearspeaker_gap);
+}
+
+module RearCameraAperture(){
+ CaseBase_rhsflip([1])
+ mirror([0, 0, 1])
+ linear_extrude(height = 20)
+ mirror([0, 1, 0])
+ translate(bumper)
+ rectfromto(camera_pos_tl, camera_pos_br);
+}
+