* attach hinge to panel
* cut rear of panel out behind hinge connector for full 180⁰ of motion
* generate male joint
* move p1/coin buttons to avoid interfernce with hinge
* increase height of panel slightly
// GPLv3 or (at your option) any later version
// .. insert license text here ...
// GPLv3 or (at your option) any later version
// .. insert license text here ...
+// todo:
+// - hinge
+// - screw holes + captive nut to mount
+// - internal mount for mcu and battery
+// - hole for usb panel mount
+// - bevel lid
+
+// maybe/wishlist:
+// - wire routing clips on panel?
+// - buttons on side for pinball?
+// - vent under mcu/battery?
+// - slant panel toward player?
+
+// bugs:
+// - hinge is not aligned -- either male arm length or connector placement is wrong
+
use <obiscad/bcube.scad>
use <obiscad/attach.scad>
use <joints.scad>
use <obiscad/bcube.scad>
use <obiscad/attach.scad>
use <joints.scad>
module preview () {
rotate ([-10, 0, 0]) translate ([0, 0, box_h+20]) panel ();
case ();
module preview () {
rotate ([-10, 0, 0]) translate ([0, 0, box_h+20]) panel ();
case ();
+ for (i = [2 ,4]) translate ([panel_w+hinge_joint_width*i, 0, 0]) hinge_male ();
// CONFIGURATION
panel_w = 250;
// CONFIGURATION
panel_w = 250;
box_h = 80; // fixme: box_d.
box_wall = 2;
base_h = 5; //fixme: thickness?
box_h = 80; // fixme: box_d.
box_wall = 2;
base_h = 5; //fixme: thickness?
-// bcube parameters, clean up
-cr = box_wall*2;
-cres = 0;
+$button_d = 30; // I think this should be special
+// fixme: names (js -> joystick)
js_width = 85;
js_height = 40;
js_width = 85;
js_height = 40;
+// fixme: these are a bit confused
hinge_joint_width = 4;
hinge_joint_thickness = 5;
hinge_base_height = 10;
hinge_joint_width = 4;
hinge_joint_thickness = 5;
hinge_base_height = 10;
+hinge_joint_height = 10;
+hinge_arm_length = 50;
+
+
+// gunk that should be elsewhere...
+// bcube parameters, clean up
+cr = box_wall*2;
+cres = 0;
module joystick () {
bolt_d = 8;
center_hole_d = 24;
module joystick () {
bolt_d = 8;
center_hole_d = 24;
translate ([x, y, 0]) circle (d=bolt_d); // need slot instead
}
circle (d=center_hole_d);
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 ([js_width, js_height], center=true); // not right...
}
- difference() {
- bcube([panel_w, panel_h, box_h-base_h], cr, cres);
- bcube([panel_w-box_wall, panel_h-box_wall, box_h+1], cr, cres);
+ 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);
+ }
+ attach (case_connector_wall (x=10), hinge_connector_back ()) hinge_female_base ();
+ }
+ attach (case_connector_wall (x=10), hinge_connector_back ()) hinge_female_cut ();
}
%connector (case_connector_wall (x=10));
}
%connector (case_connector_wall (x=10));
- attach (case_connector_wall (x=10), hinge_connector_back ()) hinge_female ();
-// specify which wall (rear, front, left, right).
-// offset from center of wall, as vector
+// 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 ];
// HINGE
// 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 ];
// HINGE
+// hinge todo:
+// calculate z offset so that hinge will align when closed
+// calculate offset into panel surface for length of peg
+// attach to case, calculating offset from wall as fixed value + width
+
+// add connector for pin to socket so that can easily be test fit in
+// software instead of guessing
+
+// 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_base_height) = [ [0, th/2, h/2], [0,1, 0], 0 ];
-module hinge_female () {
+// todo:
+// gusset support underneath
+// split into base and negative so that a hole can be punched into case wall
+
+module hinge_female_base () {
+ w = hinge_joint_width * 2;
+ th = hinge_joint_thickness * 2;
+
+ %connector (hinge_connector_back ());
+ cube ([w, th, hinge_base_height], center=true);
+}
+
+module hinge_female_cut () {
w = hinge_joint_width * 2;
th = hinge_joint_thickness * 2;
w = hinge_joint_width * 2;
th = hinge_joint_thickness * 2;
+
+ // cruft from earlier hacking, remove...
jt = hinge_joint_thickness;
jw = hinge_joint_width;
jt = hinge_joint_thickness;
jw = hinge_joint_width;
- %connector (hinge_connector_back ());
+ joint_male_negative(male_joint_width=jw, male_joint_thickness=jt, forward_rom=90, backward_rom=90, male_joint_height=hinge_joint_height);
+}
+module hinge_female () {
- cube ([w, th, h], center=true);
- joint_male_negative(male_joint_width=jw, male_joint_thickness=jt, forward_rom=90, backward_rom=90, male_joint_height=10);
+ hinge_female_base ();
+ hinge_female_cut ();
+module hinge_male () {
+ for (i=[0,1]) mirror ([0, i, 0]) translate ([0, -hinge_arm_length/4, 0])
+ joint_male(male_joint_width=hinge_joint_width, male_joint_thickness=hinge_joint_thickness, male_joint_height=hinge_arm_length/2, side=true);
+
+}
+
+
+// hinge to panel...
+// mount hinge on panel arm_length back from edge
+
+// fixme: wall thickness is not taken into account
+
+// 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 ];
+
module panel () {
difference () {
case_base ();
linear_extrude (base_h*2,center=true) panel_layout ();
}
module panel () {
difference () {
case_base ();
linear_extrude (base_h*2,center=true) panel_layout ();
}
+ %connector (panel_c);
+ attach (panel_c, hinge_connector_back ()) hinge_female ();
}
module panel_attach (position, angle=0) {
}
module panel_attach (position, angle=0) {
panel_attach ([0, 0], 90) joystick ();
// p1, coin (floating off in the distance...)
panel_attach ([0, 0], 90) joystick ();
// p1, coin (floating off in the distance...)
- translate ([160, 0, 0]) {
+ translate ([140, 0, 0]) {
$button_d=16;
for (x = [0, $button_d+10]) {
panel_attach ([x, 42]) button ();
$button_d=16;
for (x = [0, $button_d+10]) {
panel_attach ([x, 42]) button ();