From 4d27c092db0ac3352ac25455b54c2e0dbc1cc730 Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Sun, 4 Jan 2026 16:13:10 +0100 Subject: [PATCH] Better pcb approximation --- enclosure/cutouts.scad | 16 ++++++++++ enclosure/fabula_enclosure.scad | 19 +++++++----- enclosure/internal_components.scad | 49 ++++++++++++++++++++++-------- enclosure/test_fit.scad | 4 +-- 4 files changed, 66 insertions(+), 22 deletions(-) diff --git a/enclosure/cutouts.scad b/enclosure/cutouts.scad index de79329..48312e4 100644 --- a/enclosure/cutouts.scad +++ b/enclosure/cutouts.scad @@ -1,2 +1,18 @@ // The cutouts to allow external components (such as buttons and connectors) to be mounted on the box +// 4056-based li-ion charging module +module usb_cutout() { + hull() { + translate([0, -3, 0]) cylinder(h=11, d=8); + translate([0, 3, 0]) cylinder(h=11, d=8); + translate([0, 0, 12]) cube([3, 8.9, 2], true); + } +} + +// 14x12mm rocker switch with 21x15mm flange +module switch_cutout() { + cube([14, 12, 11], true); // WIP +} + + +//usb_cutout(); \ No newline at end of file diff --git a/enclosure/fabula_enclosure.scad b/enclosure/fabula_enclosure.scad index 8346714..74eb9a7 100644 --- a/enclosure/fabula_enclosure.scad +++ b/enclosure/fabula_enclosure.scad @@ -9,14 +9,19 @@ use box_cut_height = 10; module fabula_enclosure_bottom() { - cap(); + difference() { + union() { + cap(); + + // Supports + translate([-30, 0, 19.1]) supports_speaker(); + translate([28, 0, 14.1]) rotate([0, 180, 90]) supports_battery(); + translate([70.4, 29, 18]) rotate([0, 0, 180]) supports_charging_module(); + } - // Supports - translate([-30, 0, 19.1]) supports_speaker(); - translate([28, 0, 14.1]) rotate([0, 180, 90]) supports_battery(); - translate([70.4, 29, 18]) rotate([0, 0, 180]) #supports_charging_module(); - - // Cutouts + // Cutouts + translate([98.4, 29, 17]) rotate([0, -90, 0]) usb_cutout(); + } } module fabula_enclosure_top() { diff --git a/enclosure/internal_components.scad b/enclosure/internal_components.scad index 65cbe07..c4b1c03 100644 --- a/enclosure/internal_components.scad +++ b/enclosure/internal_components.scad @@ -44,22 +44,44 @@ module switch() { translate([0, 0, 6]) rotate([0, 15, 0]) cube([12, 10, 5], true); } +// Cherry MX (compatible) mechanical keyboard switch, i.e. Gatheron Blue +module mechanical_switch() { + // Body + cube([15.5, 15.5, 11.5], true); + // Stem + translate([0, 0, (11.5 + 3.5) / 2]){ + cube([1, 3.8, 3.5], true); + cube([3.8, 1, 3.5], true); + } +} + // Mainboard. The highest component is the capacitor with a total height of 18mm, but we round to 20 for good measure. module pcb() { - translate([0, 0, -10]) { - linear_extrude(height = 20) { - hull() { - /* - Center svg - Bounding box: - Min: 19.20, 49.71 - Max: 97.09, 198.06 - Size: 77.89, 148.35 - */ - translate([-77.89 / 2 - 19.20, -148.35 / 2 - 49.71, 0]) import("pcb.svg"); + // Board + translate([-77.89 / 2 - 19.20, -148.35 / 2 - 49.71, 0]) { + linear_extrude(height = 1.4) { + difference() { + hull() { + /* + Center svg + Bounding box: + Min: 19.20, 49.71 + Max: 97.09, 198.06 + Size: 77.89, 148.35 + */ + import("pcb.svg"); + } + import("pcb.svg"); } } } + // Keys + translate([-13.4, -20.1, 11.5/2 + 1.4]) mechanical_switch(); + translate([-23.4, -44.6, 11.5/2 + 1.4]) mechanical_switch(); + translate([12.6, -35.6, 11.5/2 + 1.4]) mechanical_switch(); + translate([2.05, -61.05, 11.5/2 + 1.4]) mechanical_switch(); + // Box to account for the other various components + translate([-28, 4, 0]) cube([53, 70, 18]); } module battery_18650() { @@ -70,5 +92,6 @@ module battery_18650() { //speaker_80(); //li_ion_4056_charger_module(); //switch(); -//pcb(); -//battery_18650(); \ No newline at end of file +pcb(); +//battery_18650(); +//mechanical_switch(); diff --git a/enclosure/test_fit.scad b/enclosure/test_fit.scad index e3684c6..5bec6fa 100644 --- a/enclosure/test_fit.scad +++ b/enclosure/test_fit.scad @@ -7,7 +7,7 @@ use module test_fit_components() { // Internal components translate([0, 30, 0]) speaker_80(); - translate([0, 0, 35]) pcb(); + translate([0, 0, 26]) pcb(); translate([0, -28, 9]) rotate([0, 90, 0]) battery_18650(); // Components that require cutout on external shell @@ -16,5 +16,5 @@ module test_fit_components() { } test_fit_components(); -translate([0, 0, 20]) rotate([0, 0, -90]) rotate([180, 0, 0]) #fabula_enclosure_bottom(); +translate([0, 0, 20]) rotate([0, 0, -90]) rotate([180, 0, 0]) fabula_enclosure_bottom(); //translate([0, 0, 20]) rotate([0, 0, -90]) rotate([180, 0, 0]) #fabula_enclosure_top(); \ No newline at end of file