wip: 3d printed panel

todo:
  - panel lettering
  - sides and back of box
  - universal panel mounting system (logitech, honeycomb) compatibility
This commit is contained in:
2023-04-11 22:33:48 +02:00
parent fa06074eb8
commit 9c1d1c003c
2 changed files with 194 additions and 0 deletions

86
3dprint/buttons.scad Normal file
View File

@@ -0,0 +1,86 @@
$fa = 1;
$fs = 0.4;
epsilon = 0.01;
text_depth = 1;
button_thickness = 3;
switch_shaft_upper = 3;
switch_shaft_lower = 3.5;
switch_shaft_length = 8.8;
shaft_outer = 7;
shaft_length = 5;
print_spacing = 10;
module button(label, width, height, size=4) {
difference() {
cube([width, height, button_thickness]);
translate([0, 0, epsilon])
button_text(label, width, height, text_depth+epsilon, size=size);
}
translate([width/2, height/2, 0])
difference() {
translate([0, 0, -shaft_length])
cylinder(h=shaft_length, r=shaft_outer/2);
translate([0, 0, -switch_shaft_length])
cylinder(h=switch_shaft_length, r1=switch_shaft_lower/2,
r2=switch_shaft_upper/2);
}
}
module button_text(label, width, height, thickness, size=4) {
translate([width/2, height/2, button_thickness-thickness])
linear_extrude(thickness)
text(label, font="Bitstream Vera Sans Mono:style=Bold",
halign="center", valign="center", size=size);
}
buttons = ["HDG", "LNAV", "ALT", "VNAV",
"VS", "FLC", "SPD", "APR",
"LVL", "FD", "AP", "A/T", "N1"];
button_width = 15;
button_height = 8;
buttons_small = ["", "", "c/o"];
button_small_width = 8;
button_small_height = 8;
render_text = true;
render_button = true;
row_length = 4;
for (i = [0:len(buttons)-1]) {
translate([(i%row_length)*(button_width+print_spacing),
floor(i/row_length)*(button_height+print_spacing), 0]) {
if (render_text && render_button) {
color("black")
button(buttons[i], button_width, button_height);
color("white")
button_text(buttons[i], button_width, button_height, text_depth);
} else if (render_button) {
button(buttons[i], button_width, button_height);
} else if (render_text) {
button_text(buttons[i], button_width, button_height, text_depth);
}
}
}
for (i = [0:len(buttons_small)-1]) {
translate([(i%row_length)*(button_small_width+print_spacing),
floor(i/row_length)*(button_small_height+print_spacing)+80, 0]) {
if (render_text && render_button) {
color("black")
button(buttons_small[i], button_small_width, button_small_height,
size=3);
color("white")
button_text(buttons_small[i], button_small_width,
button_small_height, text_depth, size=3);
} else if (render_button) {
button(buttons_small[i], button_small_width, button_small_height, size=3);
} else if (render_text) {
button_text(buttons_small[i], button_small_width, button_small_height,
text_depth, size=3);
}
}
}

108
3dprint/panel.scad Normal file
View File

@@ -0,0 +1,108 @@
$fa = 1;
$fs = 0.4;
panel_border = 5;
panel_width = 160 + 2*panel_border;
panel_height = 100 + 2*panel_border;
panel_thick = 2;
led_diam = 3;
button_width = 15;
button_height = 8;
button_small_width = 8;
button_small_height = 8;
enc_shaft_diam = 6;
led_height = 12.7;
led_width = 4*2.54;
cutout_depth = panel_thick + 1;
wiggle_room = 0.1;
epsilon = 0.01;
module cutout_rect(left, upper, width, height) {
translate([left + 5 - wiggle_room,
panel_height - 5 - upper - height - wiggle_room, 0])
cube([width + 2*wiggle_room, height + 2*wiggle_room,
cutout_depth+2*epsilon]);
}
module cutout_rect_c(c_x, c_y, width, height) {
translate([c_x + 5 - width/2 - wiggle_room,
panel_height - 5 - c_y - height/2 - wiggle_room, 0])
cube([width + 2*wiggle_room, height + 2*wiggle_room,
cutout_depth+2*epsilon]);
}
module cutout_cyl(c_x, c_y, diam) {
translate([c_x + 5 - wiggle_room, panel_height - 5 - c_y - wiggle_room, 0])
cylinder(r=diam/2 + wiggle_room, h=cutout_depth+2*epsilon);
}
module screw_point(c_x, c_y) {
translate([c_x + 5, panel_height - 5 - c_y, -5])
difference() {
cylinder(r=5.2/2+1, h=5);
translate([0, 0, -epsilon])
cylinder(r=5.2/2, $fn=6, h=2+epsilon);
}
}
function col_x(col) = (5.5+col*8)*2.54;
difference() {
union() {
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);
screw_point(61*2.54, 37.5*2.54);
}
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);
// 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);
}
}
}