forked from lauri/sumorobot-frame
180 lines
5.0 KiB
OpenSCAD
180 lines
5.0 KiB
OpenSCAD
|
WIDTH = 114;
|
||
|
HEIGHT = 63;
|
||
|
DEPTH = 30;
|
||
|
|
||
|
R = 30;
|
||
|
THICKNESS = 2;
|
||
|
|
||
|
BORDER_RADIUS = 4;
|
||
|
JOYSTICK_AXIS_DIAMETER = 31;
|
||
|
JOYSTICK_TO_BUTTONS = 45.72;
|
||
|
BUTTON_DIAMETER = 11.5;
|
||
|
T = 0.2;
|
||
|
BUTTON_PLACEMENT_DIAMETER = 22.86;
|
||
|
BUTTON_PLACEMENT_LEFT = WIDTH / 2 - JOYSTICK_TO_BUTTONS / 2;
|
||
|
JOYSTICK_LEFT = WIDTH / 2 + JOYSTICK_TO_BUTTONS / 2;
|
||
|
JOYSTICK_TOP = HEIGHT / 2;
|
||
|
BUTTON_SINK = 13.5;
|
||
|
|
||
|
TRAY_WIDTH = 35;
|
||
|
TRAY_HEIGHT = 52;
|
||
|
TRAY_DEPTH = 6;
|
||
|
TRAY_THICKNESS = 1;
|
||
|
|
||
|
|
||
|
SWITCH_POSITION = WIDTH - 27;
|
||
|
SWITCH_HEIGHT = 12.7;
|
||
|
SWITCH_WIDTH = 19.3;
|
||
|
|
||
|
SCREW_HOLE = 6.3;
|
||
|
|
||
|
STANDOFF_H = 20;
|
||
|
STANDOFF_D2 = 4.65;
|
||
|
STANDOFF_D = STANDOFF_D2 / 0.866;
|
||
|
|
||
|
module box(width, height, depth, h1 = STANDOFF_D, h2 = STANDOFF_D, hd = STANDOFF_H, hr=6) {
|
||
|
difference() {
|
||
|
translate([0, 0, -THICKNESS]) {
|
||
|
// Bottom
|
||
|
translate([-BORDER_RADIUS, 0, 0]) cube([width + BORDER_RADIUS * 2, HEIGHT, THICKNESS]);
|
||
|
translate([0, -BORDER_RADIUS, 0]) cube([width, height + BORDER_RADIUS * 2, THICKNESS]);
|
||
|
|
||
|
// Walls
|
||
|
translate([0, -BORDER_RADIUS, 0]) cube([width, THICKNESS, depth + THICKNESS]);
|
||
|
translate([-BORDER_RADIUS, 0, 0]) cube([THICKNESS, height, depth + THICKNESS]);
|
||
|
translate([0, height + BORDER_RADIUS - THICKNESS, 0]) cube([width, THICKNESS, depth + THICKNESS]);
|
||
|
translate([width + BORDER_RADIUS - THICKNESS, 0, 0]) cube([THICKNESS, height, depth + THICKNESS]);
|
||
|
|
||
|
|
||
|
// Screw hole cylinders
|
||
|
cylinder(r = BORDER_RADIUS, h = depth + THICKNESS, $fn = R);
|
||
|
translate([WIDTH, 0, 0]) cylinder(r = BORDER_RADIUS, h = depth + THICKNESS, $fn = R);
|
||
|
translate([0, HEIGHT, 0]) cylinder(r = BORDER_RADIUS, h = depth + THICKNESS, $fn = R);
|
||
|
translate([WIDTH, HEIGHT, 0]) cylinder(r = BORDER_RADIUS, h = depth + THICKNESS, $fn = R);
|
||
|
}
|
||
|
|
||
|
// Screw hole
|
||
|
translate([0, 0, depth - hd - T]) {
|
||
|
cylinder(d1 = h1+T, d2 = h2+T, h = hd+T+T, $fn = hr);
|
||
|
translate([WIDTH, 0, 0]) cylinder(d1 = h1+T, d2 = h2+T, h = hd+T+T, $fn = hr);
|
||
|
translate([0, HEIGHT, 0]) cylinder(d1 = h1+T, d2 = h2+T, h = hd+T+T, $fn = hr);
|
||
|
translate([WIDTH, HEIGHT, 0]) cylinder(d1 = h1+T, d2 = h2+T, h = hd+T+T, $fn = hr);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Cover
|
||
|
translate([0, -THICKNESS - BORDER_RADIUS * 2, 0]) {
|
||
|
mirror([0, 1, 0]) {
|
||
|
difference() {
|
||
|
box(WIDTH, HEIGHT, 0, h1 = 5.4, h2 = 2.8, hr=R, hd = THICKNESS);
|
||
|
translate([WIDTH/2-5, -BORDER_RADIUS+THICKNESS+T+1, -THICKNESS-T])
|
||
|
cube([10, 4, 10]);
|
||
|
}
|
||
|
|
||
|
// Switch fixer
|
||
|
translate([SWITCH_POSITION + T, -BORDER_RADIUS, 0]) {
|
||
|
cube([SWITCH_WIDTH - T - T, BORDER_RADIUS, DEPTH - SWITCH_HEIGHT - T]);
|
||
|
}
|
||
|
|
||
|
// Charger mount
|
||
|
translate([WIDTH/2-19/2-3, -BORDER_RADIUS+THICKNESS+T, 0]) {
|
||
|
difference() {
|
||
|
cube([19+3+3, 7, DEPTH - SWITCH_HEIGHT - T]);
|
||
|
translate([+3, 0, 0])
|
||
|
cube([19, 3, 20]);
|
||
|
|
||
|
translate([7.5, 0, 0])
|
||
|
cube([10, 5, 20]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
module screw_hole(dia=SCREW_HOLE) {
|
||
|
difference() {
|
||
|
cylinder(h = 11, d = 8, $fn = R);
|
||
|
translate([0, 0, TRAY_DEPTH])
|
||
|
cylinder(h = TRAY_DEPTH + T, d = dia, $fn = R);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module button() {
|
||
|
cylinder(d1 = BUTTON_DIAMETER + THICKNESS * 2 + T, d2 = BUTTON_DIAMETER + T, h = THICKNESS + T * 2, $fn = R);
|
||
|
}
|
||
|
|
||
|
module case () {
|
||
|
difference() {
|
||
|
union() {
|
||
|
box(WIDTH, HEIGHT, DEPTH);
|
||
|
|
||
|
|
||
|
// Switch holder
|
||
|
translate([SWITCH_POSITION - 5, -BORDER_RADIUS + T + T, 0]) {
|
||
|
cube([SWITCH_WIDTH + 10, BORDER_RADIUS, DEPTH]);
|
||
|
translate([-85+6, 0,0 ])
|
||
|
cube([85, 5,3.5]);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
// Switch cutout
|
||
|
translate([SWITCH_POSITION, -BORDER_RADIUS - T, 0]) {
|
||
|
cube([SWITCH_WIDTH, THICKNESS, HEIGHT]);
|
||
|
translate([-1, THICKNESS, 0])
|
||
|
cube([SWITCH_WIDTH + 2, BORDER_RADIUS, HEIGHT]);
|
||
|
}
|
||
|
|
||
|
|
||
|
union() {
|
||
|
|
||
|
translate([JOYSTICK_LEFT, JOYSTICK_TOP, 5]) {
|
||
|
sphere(JOYSTICK_AXIS_DIAMETER / 2);
|
||
|
}
|
||
|
|
||
|
translate([BUTTON_PLACEMENT_LEFT, JOYSTICK_TOP, -THICKNESS]) {
|
||
|
translate([BUTTON_PLACEMENT_DIAMETER / 2, 0, -T]) button();
|
||
|
translate([0, BUTTON_PLACEMENT_DIAMETER / 2, -T]) button();
|
||
|
translate([-BUTTON_PLACEMENT_DIAMETER / 2, 0, -T]) button();
|
||
|
translate([0, -BUTTON_PLACEMENT_DIAMETER / 2, -T]) button();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/* PCB mounting holes */
|
||
|
translate([BUTTON_PLACEMENT_LEFT, JOYSTICK_TOP, 0]) {
|
||
|
translate([-18.9, BUTTON_PLACEMENT_DIAMETER / 2, 0]) {
|
||
|
screw_hole(1.9);
|
||
|
translate([0, -28, 0]) {
|
||
|
screw_hole(1.9);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
translate([BUTTON_PLACEMENT_LEFT + JOYSTICK_TO_BUTTONS, JOYSTICK_TOP, 0]) {
|
||
|
|
||
|
translate([+12.2 + 1.5, +24.7 + 1.5, 0]) {
|
||
|
screw_hole(1.9);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
case ();
|