From f6620219898ce1a99aab87708aba813423ba3f03 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Thu, 16 Mar 2017 00:41:45 -0400 Subject: [PATCH] arcade-panel: degunk variable names --- ble arcade controller/arcade-box.scad | 49 +++++++++++++-------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/ble arcade controller/arcade-box.scad b/ble arcade controller/arcade-box.scad index 2c7c8b5..0fa783e 100644 --- a/ble arcade controller/arcade-box.scad +++ b/ble arcade controller/arcade-box.scad @@ -27,31 +27,30 @@ use preview(); module preview () { - rotate ([-10, 0, 0]) translate ([0, 0, box_h+20]) panel (); + rotate ([-10, 0, 0]) translate ([0, 0, box_depth+20]) panel (); case (); - for (i = [2 ,4]) translate ([panel_w+hinge_joint_width*i, 0, 0]) hinge_male (); + for (i = [2 ,4]) translate ([panel_width+hinge_joint_width*i, 0, 0]) hinge_male (); } // CONFIGURATION -panel_w = 250; -panel_h = 130; +panel_width = 250; +panel_height = 130; -box_h = 80; // fixme: box_d. +box_depth = 80; box_wall = 2; -base_h = 5; //fixme: thickness? +box_base_thickness = 5; $button_d = 30; // I think this should be special -// fixme: names (js -> joystick) -js_width = 85; -js_height = 40; +joystick_width = 85; +joystick_height = 40; // fixme: these are a bit confused -hinge_joint_width = 4; +hinge_joint_width = 8; hinge_joint_thickness = 5; -hinge_base_height = 10; +hinge_box_base_thicknesseight = 10; hinge_joint_height = 10; hinge_arm_length = 50; @@ -72,26 +71,26 @@ module joystick () { bolt_d = 8; center_hole_d = 24; - for (x = [-js_width/2, js_width/2], y = [-js_height/2, js_height/2]) { + for (x = [-joystick_width/2, joystick_width/2], y = [-joystick_height/2, joystick_height/2]) { translate ([x, y, 0]) circle (d=bolt_d); // need slot instead } circle (d=center_hole_d); - %square ([js_width, js_height], center=true); // not right... + %square ([joystick_width, joystick_height], center=true); // not right... } // CASE -module case_base (h=base_h) { - bcube([panel_w, panel_h, h], cr, cres); +module case_base (h=box_base_thickness) { + bcube([panel_width, panel_height, h], cr, cres); } module case_walls () { difference () { union () { difference() { - bcube([panel_w, panel_h, box_h-base_h], cr, cres); - bcube([panel_w-box_wall*2, panel_h-box_wall*2, box_h+1], cr, cres); + bcube([panel_width, panel_height, box_depth-box_base_thickness], cr, cres); + bcube([panel_width-box_wall*2, panel_height-box_wall*2, box_depth+1], cr, cres); } attach (case_connector_wall (x=10), hinge_connector_back ()) hinge_female_base (); } @@ -102,7 +101,7 @@ module case_walls () { module case () { case_base (); - translate ([0, 0, box_h/2]) case_walls (); + translate ([0, 0, box_depth/2]) case_walls (); } @@ -110,7 +109,7 @@ module case () { // specify which wall (rear, front, left, right). vector addition may help... // offset from center of wall, as vector (and use vector subtraction!) // optional: inside/outside -function case_connector_wall (x=0, y=0, z=0) = [ [panel_w/2-x, panel_h/2-y, (box_h-base_h)/2-z], [0,-1, 0], 0 ]; +function case_connector_wall (x=0, y=0, z=0) = [ [panel_width/2-x, panel_height/2-y, (box_depth-box_base_thickness)/2-z], [0,-1, 0], 0 ]; // HINGE @@ -125,7 +124,7 @@ function case_connector_wall (x=0, y=0, z=0) = [ [panel_w/2-x, panel_h/2-y, (box // should panel connector be on its side? Limits motion to 90⁰ Or // maybe just walls only + fillet with no base... -function hinge_connector_back (th=hinge_joint_thickness*2, h=hinge_base_height) = [ [0, th/2, h/2], [0,1, 0], 0 ]; +function hinge_connector_back (th=hinge_joint_thickness*2, h=hinge_box_base_thicknesseight) = [ [0, th/2, h/2], [0,1, 0], 0 ]; // todo: // gusset support underneath @@ -136,7 +135,7 @@ module hinge_female_base () { th = hinge_joint_thickness * 2; %connector (hinge_connector_back ()); - cube ([w, th, hinge_base_height], center=true); + cube ([w, th, hinge_box_base_thicknesseight], center=true); } module hinge_female_cut () { @@ -173,12 +172,12 @@ module hinge_male () { // cleanup after general case_connector_wall() is done -panel_c = [ [panel_w/2-10, panel_h/2-hinge_arm_length, -base_h/2+0.01], [0,0, 1], 180 ]; +panel_c = [ [panel_width/2-10, panel_height/2-hinge_arm_length, -box_base_thickness/2+0.01], [0,0, 1], 180 ]; module panel () { difference () { case_base (); - linear_extrude (base_h*2,center=true) panel_layout (); + linear_extrude (box_base_thickness*2,center=true) panel_layout (); } %connector (panel_c); attach (panel_c, hinge_connector_back ()) hinge_female (); @@ -187,7 +186,7 @@ module panel () { module panel_attach (position, angle=0) { x = position[0]; y = position[1]; - c1 = [ [x, y, base_h/2], [0,0,1], angle ]; + c1 = [ [x, y, box_base_thickness/2], [0,0,1], angle ]; a1 = [ [0,0, 0], [0,0,0], 0 ]; // %connector (c1); // fixme: don't use 2d for layout attach (c1, a1) children (); @@ -195,7 +194,7 @@ module panel_attach (position, angle=0) { // panel layout inspired by the Neo Geo layout module panel_layout () { - translate ([-panel_w/2 + 40, 0, 0]) { + translate ([-panel_width/2 + 40, 0, 0]) { panel_attach ([0, 0], 90) joystick (); // p1, coin (floating off in the distance...) -- 2.20.1