scad/paintbrush-case.scad

125 lines
3.4 KiB
OpenSCAD

$wall_thickness = 1;
$case_height = 15;
$tent_angle=15;
$tent_seat_post_r=4.9;
$tent_seat_post_h=3;
$usb_z_offset = 12; // XXX
$usb_h = 6; // XXX
$usb_w = 12; // XXX
$usb_y_offset = 8; // 8 for right hand, 10 for left hand
$power_z_offset = 10; // XXX
$power_h = 4; // XXX
$power_w = 10; // XXX
$power_y_offset = 38; // 38 for right hand, 40 for left hand
$fn = 24;
module bottom() {
hull() import("/home/rrix/Code/thepaintbrush/hardware/v5/small-paintbrush-hotswap-bottom-brd.svg");
}
module holes() {
import("/home/rrix/Code/thepaintbrush/hardware/v5/small-paintbrush-hotswap-bottom-brd-holes.svg");
}
module plate() {
import("/home/rrix/Code/thepaintbrush/hardware/v5/small-paintbrush-hotswap-mxplate-brd.svg");
}
module case() {
union() {
difference () {
union() {
translate([-15,-10,0])
minkowski() {
translate([8,3,$wall_thickness]) rotate([0,90,0])
cylinder(r=$wall_thickness, h=4);
translate([5,10,$wall_thickness]) rotate([90,0,0])
cylinder(r=$wall_thickness, h=4);
// minkowski will expand this by 2r cylinders
linear_extrude($case_height-$wall_thickness) difference() {
bottom();
}
}
translate([0,50,2])
rotate_extrude(angle=360)
translate([4,0,0])
circle(r=2);
translate([109,50,2])
rotate_extrude(angle=360)
translate([4,0,0])
circle(r=2);
}
translate([0,1,-.01]) linear_extrude($case_height-$wall_thickness) holes();
translate([0,1, 5]) linear_extrude($case_height + 20) bottom();
// switch hole
translate([$power_y_offset,4*$wall_thickness -1000, $wall_thickness + $power_z_offset])
cube([$power_w, 1000, $power_h]);
// usb hole
translate([$usb_y_offset,7*$wall_thickness,$wall_thickness + $usb_z_offset]) rotate([90,0,0])
linear_extrude(1000) offset(r=1) square([$usb_w, $usb_h]);
// tent-seat holes
translate([10,10,-.01]) cylinder(r=$tent_seat_post_r, h=$tent_seat_post_h);
translate([10,49,-.01]) cylinder(r=$tent_seat_post_r, h=$tent_seat_post_h);
translate([99,10,-.01]) cylinder(r=$tent_seat_post_r, h=$tent_seat_post_h);
translate([99,49,-.01]) cylinder(r=$tent_seat_post_r, h=$tent_seat_post_h);
}
}
}
module tent(angle) {
translate([0,0,0.7])
rotate([angle,0,0])
union(){
rotate([-angle,0,0])
minkowski() {
rotate([90,0,90]) translate([sin(angle),tan(angle),0])
linear_extrude(15) polygon(points = [[0,0],[50,0],[50,tan(angle)*50]]);
sphere(r=1);
}
translate([8,6,1])
cylinder(r=$tent_seat_post_r,
h=$tent_seat_post_h);
translate([8,6+39,1]) // diff of X front/back of tent-seat holes
cylinder(r=$tent_seat_post_r,
h=$tent_seat_post_h);
}
}
// module tented(angle=12) {
// union() {
// translate([108, cos(angle)*55, tan(angle)*55])
// rotate([-angle,0,180]) case();
// if (angle > 0) {
// translate([5,0,0]) tent(angle);
// translate([88,0,0]) tent(angle);
// }
// }
// }
mirror(v=[1,0,0]) {
case();
translate([ 0,70,0]) {
tent($tent_angle);
translate([89,0,0]) tent($tent_angle);
translate([ 0,5,0]) cube([89,40,2]);
}
}
// translate() plate();