3dprint: case WIP

This commit is contained in:
2023-04-13 17:39:05 +02:00
parent ab7f21a81f
commit 2c8609f812

View File

@@ -1,7 +1,7 @@
$fa = 1; $fa = 1;
$fs = 0.4; $fs = 0.4;
panel_border = 5; panel_border = 0;
panel_width = 160 + 2*panel_border; panel_width = 160 + 2*panel_border;
panel_height = 100 + 2*panel_border; panel_height = 100 + 2*panel_border;
panel_thick = 1; panel_thick = 1;
@@ -15,31 +15,34 @@ enc_shaft_diam = 6;
led_height = 12.7; led_height = 12.7;
led_width = 4*2.54; led_width = 4*2.54;
cutout_depth = panel_thick + 1; cutout_depth = panel_thick + 1;
guide_thick = 0.5;
guide_height = 2;
guide_length = 3;
wiggle_room = 0.1; wiggle_room = 0.1;
epsilon = 0.01; epsilon = 0.01;
module cutout_rect(left, upper, width, height) { module cutout_rect(left, upper, width, height) {
translate([left + 5 - wiggle_room, translate([left + panel_border - wiggle_room,
panel_height - 5 - upper - height - wiggle_room, 0]) panel_height - panel_border - upper - height - wiggle_room, 0])
cube([width + 2*wiggle_room, height + 2*wiggle_room, cube([width + 2*wiggle_room, height + 2*wiggle_room,
cutout_depth+2*epsilon]); cutout_depth+2*epsilon]);
} }
module cutout_rect_c(c_x, c_y, width, height) { module cutout_rect_c(c_x, c_y, width, height) {
translate([c_x + 5 - width/2 - wiggle_room, translate([c_x + panel_border - width/2 - wiggle_room,
panel_height - 5 - c_y - height/2 - wiggle_room, 0]) panel_height - panel_border - c_y - height/2 - wiggle_room, 0])
cube([width + 2*wiggle_room, height + 2*wiggle_room, cube([width + 2*wiggle_room, height + 2*wiggle_room,
cutout_depth+2*epsilon]); cutout_depth+2*epsilon]);
} }
module cutout_cyl(c_x, c_y, diam) { module cutout_cyl(c_x, c_y, diam) {
translate([c_x + 5 - wiggle_room, panel_height - 5 - c_y - wiggle_room, 0]) translate([c_x + panel_border - wiggle_room, panel_height - panel_border - c_y - wiggle_room, 0])
cylinder(r=diam/2 + wiggle_room, h=cutout_depth+2*epsilon); cylinder(r=diam/2 + wiggle_room, h=cutout_depth+2*epsilon);
} }
module screw_point(c_x, c_y, length = 5) { module screw_point(c_x, c_y, length = 5) {
translate([c_x + 5, panel_height - 5 - c_y, -length]) translate([c_x + panel_border, panel_height - panel_border - c_y, -length])
difference() { difference() {
cylinder(r=5.2/2+1, h=length); cylinder(r=5.2/2+1, h=length);
translate([0, 0, -epsilon]) translate([0, 0, -epsilon])
@@ -47,62 +50,143 @@ module screw_point(c_x, c_y, length = 5) {
} }
} }
function col_x(col) = (5.5+col*8)*2.54; module button_guide(c_x, c_y, width, height) {
translate([c_x + panel_border - width/2 - wiggle_room - guide_thick,
panel_height - panel_border - c_y - height/2 - wiggle_room - guide_thick, -panel_thick-guide_height/2]) {
difference() { cube([guide_length, guide_thick, guide_height]);
union() { cube([guide_thick, guide_length, guide_height]);
cube([panel_width, panel_height, panel_thick]);
screw_point(2*2.54, 1.5*2.54);
screw_point(61*2.54, 2.5*2.54);
screw_point(2*2.54, 37.5*2.54, length=12);
screw_point(61*2.54, 37.5*2.54, length=12);
} }
translate([0, 0, -cutout_depth+panel_thick-epsilon]) union() { translate([c_x + panel_border + width/2 + wiggle_room,
// HDG led panel_height - panel_border - c_y - height/2 - wiggle_room - guide_thick, -panel_thick-guide_height/2]) {
cutout_rect(8.9, 5.5, 3*led_width, led_height); translate([-guide_length+guide_thick, 0, 0]) cube([guide_length, guide_thick, guide_height]);
// ALT led cube([guide_thick, guide_length, guide_height]);
cutout_rect(8.9+2*led_width, 5.5 + led_height + 3*2.54, 5*led_width, led_height); }
// VS led translate([c_x + panel_border - width/2 - wiggle_room - guide_thick,
cutout_rect(8.9+6*led_width, 5.5, 5*led_width, led_height); panel_height - panel_border - c_y + height/2 + wiggle_room, -panel_thick-guide_height/2]) {
// AS led cube([guide_length, guide_thick, guide_height]);
cutout_rect(8.9+10*led_width, 5.5 + led_height + 3*2.54, 4*led_width, led_height); translate([0, -guide_length+guide_thick, 0]) cube([guide_thick, guide_length, guide_height]);
}
// HDG rot translate([c_x + panel_border + width/2 + wiggle_room,
cutout_cyl(15.24, 55, enc_shaft_diam); panel_height - panel_border - c_y + height/2 + wiggle_room, -panel_thick-guide_height/2]) {
// ALT rot translate([-guide_length+guide_thick, 0, 0]) cube([guide_length, guide_thick, guide_height]);
cutout_cyl(15.24+16*2.54, 55, enc_shaft_diam); translate([0, -guide_length+guide_thick, 0]) cube([guide_thick, guide_length, guide_height]);
// VS rot
cutout_cyl(15.24+32*2.54, 55, enc_shaft_diam);
// AS rot
cutout_cyl(15.24+48*2.54, 55, enc_shaft_diam);
// ALT INTV
cutout_rect_c(15.24+(16+6.5)*2.54, 55, button_small_width,
button_small_height);
// SPD INTV
cutout_rect_c(15.24+(48+6.5)*2.54, 55, button_small_width,
button_small_height);
// c/o
cutout_rect_c(15.24+(32+9.5)*2.54, 55-2.54, button_small_width,
button_small_height);
row_1_led_y = 55+5*2.54;
row_1_but_y = 55+8*2.54;
for (col = [0:6]) {
// HDG, LNAV, ALT, VNAV, VS, FLC, SPD
cutout_cyl(col_x(col), row_1_led_y, led_diam);
cutout_rect_c(col_x(col), row_1_but_y, button_width, button_height);
}
row_2_led_y = 55+12*2.54;
row_2_but_y = 55+15*2.54;
for (col = [0, 1.5, 2.5, 3.5, 4.5, 6]) {
// APR, LVL, FD, AP, A/T, N1
cutout_cyl(col_x(col), row_2_led_y, led_diam);
cutout_rect_c(col_x(col), row_2_but_y, button_width, button_height);
}
} }
} }
function col_x(col) = (5.5+col*8)*2.54;
panel_angle = 60;
bottom_border = 10;
top_border = 10;
top_shelf = 15;
module panel() {
row_1_but_y = 55+8*2.54;
row_2_but_y = 55+15*2.54;
buttons = concat([[15.24+(16+6.5)*2.54, 55, button_small_width, button_small_height],
[15.24+(48+6.5)*2.54, 55, button_small_width, button_small_height],
[15.24+(32+9.5)*2.54, 55-2.54, button_small_width, button_small_height]],
[for (col = [0:6]) [col_x(col), row_1_but_y, button_width, button_height]],
[for (col = [0, 1.5, 2.5, 3.5, 4.5, 6]) [col_x(col), row_2_but_y, button_width, button_height]]);
difference() {
union() {
cube([panel_width, panel_height, panel_thick]);
for (but = buttons) {
button_guide(but[0], but[1], but[2], but[3]);
}
screw_point(2*2.54, 1.5*2.54);
screw_point(61*2.54, 2.5*2.54);
screw_point(2*2.54, 37.5*2.54, length=12);
screw_point(61*2.54, 37.5*2.54, length=12);
}
translate([0, 0, -cutout_depth+panel_thick-epsilon]) union() {
// HDG led
cutout_rect(8.9, 5.5, 3*led_width, led_height);
// ALT led
cutout_rect(8.9+2*led_width, 5.5 + led_height + 3*2.54, 5*led_width, led_height);
// VS led
cutout_rect(8.9+6*led_width, 5.5, 5*led_width, led_height);
// AS led
cutout_rect(8.9+10*led_width, 5.5 + led_height + 3*2.54, 4*led_width, led_height);
// HDG rot
cutout_cyl(15.24, 55, enc_shaft_diam);
// ALT rot
cutout_cyl(15.24+16*2.54, 55, enc_shaft_diam);
// VS rot
cutout_cyl(15.24+32*2.54, 55, enc_shaft_diam);
// AS rot
cutout_cyl(15.24+48*2.54, 55, enc_shaft_diam);
for (but = buttons) {
cutout_rect_c(but[0], but[1], but[2], but[3]);
}
row_1_led_y = 55+5*2.54;
for (col = [0:6]) {
// HDG, LNAV, ALT, VNAV, VS, FLC, SPD
cutout_cyl(col_x(col), row_1_led_y, led_diam);
}
row_2_led_y = 55+12*2.54;
for (col = [0, 1.5, 2.5, 3.5, 4.5, 6]) {
// APR, LVL, FD, AP, A/T, N1
cutout_cyl(col_x(col), row_2_led_y, led_diam);
}
}
}
translate([0, -bottom_border/2, 0]) rotate([0, 90, 0]) screw_block();
translate([0, panel_height+top_border/2-2.5, 0]) rotate([0, 90, 0]) screw_block();
translate([160, -bottom_border/2, -5]) rotate([0, -90, 0]) screw_block();
translate([160, panel_height+top_border/2-2.5, -5]) rotate([0, -90, 0]) screw_block();
translate([0, 0, -12]) cube([160, 100, 1]); // dummy PCB
translate([0, -bottom_border, 0]) cube([160, bottom_border, 1]);
translate([0, 100, 0]) cube([160, top_border, 1]);
rotate([0, -90, 0]) translate([0, 0, -160]) linear_extrude(height=160)
polygon([[0, 100+top_border], [1, 100+top_border],
[0, 100+top_border+panel_thick/tan(panel_angle)+epsilon]]);
}
module screw_block() {
difference() {
cube([5, 5, 10]);
translate([2.5, 2.5, -epsilon]) cylinder(r=1, h=7+epsilon);
}
}
rotate([panel_angle, 0, 0]) {
// panel part
panel();
}
// case part
difference() {
union() {
translate([0, -bottom_border*cos(panel_angle), -bottom_border*sin(panel_angle)])
cube([160, top_shelf + cos(panel_angle)*(100+bottom_border+top_border), 1]);
translate([0, (100+top_border)*cos(panel_angle), (100+top_border)*sin(panel_angle)])
translate([0, -panel_thick*sin(panel_angle), -panel_thick*cos(panel_angle)])
cube([160, top_shelf+panel_thick*sin(panel_angle), 1]);
translate([0, (100+top_border)*cos(panel_angle)+top_shelf-panel_thick,
-bottom_border*sin(panel_angle)+panel_thick])
//translate([0, (100+top_border)*cos(panel_angle), (100+top_border)*sin(panel_angle)])
//rotate([-90, 0, 0])
// translate([0, panel_thick*cos(panel_angle), top_shelf-panel_thick])
cube([160, 1+epsilon,
(100+bottom_border+top_border)*sin(panel_angle)-3*panel_thick*cos(panel_angle)]);
}
rotate([panel_angle, 0, 0]) panel();
}
# union() {
polyhedron([[0, -bottom_border, 1],
[0, panel_height+top_border, 1],
[0, panel_height+top_border, 0]]);
}