Files
RP2350_MIDI_Lighter/Housing/RP2350_MIDI_Lighter_Housing.scad
2025-08-21 13:42:44 +02:00

277 lines
7.0 KiB
OpenSCAD

use <MCAD/boxes.scad>
use <MCAD/regular_shapes.scad>
include <RP2350_MIDI_Lighter_PCB.scad>
include <RP2350_MIDI_Lighter_Definition.scad>
Show_FAD_Logo = true;
Show_PCB = false;
$preview = false;
Alternative = true;
// Info //
// This version has the walls of the top part mostly associated to the to cover
if(Show_PCB)
{
PCB();
translate([0,0,+PCB_T/2]) Spacer_Top();
translate([0,0,-PCB_T/2]) Spacer_Bot();
}
Top();
// Display_GC9A01A_Cover();
// color([1.0, 0.4, 0.4]) Bottom(Alternative);
// color([0.4, 0.4, 1.0]) Bottom_Wall(Alternative);
module Display_GC9A01A_Cover()
{
color([0.4, 1.0, 0.4], 1.5)
translate([0, 0, +Spacer_Top_Height + PCB_T/2 + 5])
translate(GC9A01A)
difference() {
GC9A01A_Cover_Plate(1, 1);
GC9A01A_Cover_Cutout(10);
}
}
module Top()
{
difference()
{
translate([0, 0, +Spacer_Top_Height + PCB_T/2])
union()
{
difference()
{
union()
{
Top_Plate();
// Top_Wall();
translate([0, 0, +Cover_T_T]) Screw_Rings_M3();
// translate([0, 0, +Cover_T_T]) Relief_Rings_M3();
}
Screw_Holes_M3();
for (i = [0:1]) {
translate([0, 0, Cover_T_T/2])
translate(MIDI_Plugs[i])
scale([1, 1, 10]) MIDI_Plug_Cutout();
}
translate(Rotary_Encoder) Screw_Drill(7.5);
translate(GC9A01A) GC9A01A_Cutout(5*Cover_T_T);
translate([0, 0, +Cover_T_T-0.5])
translate(GC9A01A) GC9A01A_Cover_Plate(10, 1.01);
}
for (i = [0:1]) {
translate([0, 0, Cover_T_T]) translate(MIDI_Plugs[i]) MIDI_Plug_Arc();
}
if(Show_FAD_Logo == true) {
translate([PCB_W/2, 9.5, Cover_T_T])
scale([0.02, 0.02, 2])
intersection() {
translate([0, 0, 0.5]) cube([500, 500, 1], center=true);
import("FAD_Logo.stl", convexity=3, $fn = $preview ? 32 : 100);
}
}
}
PCB_Cutouts_Top();
}
}
module Top_Wall()
{
translate([PCB_W/2, PCB_H/2, -Wall_T_H/2])
union()
{
difference()
{
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, 1*Wall_T_H], 2, true, $fn = $preview ? 32 : 100);
roundedBox([PCB_W + 1*Cover_O, PCB_H + 1*Cover_O, 2*Wall_T_H], 2, true, $fn = $preview ? 32 : 100);
}
// Internak Support Structures
translate([+PCB_W/2+Cover_O/2, -13, 0]) translate([-5/2, 0, PCB_T/2]) cube([5, 2, Wall_T_H-PCB_T], center=true);
translate([Cover_O/4, -PCB_H/2-Cover_O/2, 0]) translate([-1/2, 5/2, PCB_T/2]) cube([2, 5, Wall_T_H-PCB_T], center=true);
}
}
module Top_Plate()
{
translate([PCB_W/2, PCB_H/2, Cover_T_T/2])
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, Cover_T_T], 2, true, $fn = $preview ? 32 : 100);
}
module Bottom(Alternative)
{
translate([0, 0, -Spacer_Bot_Height - PCB_T/2])
{
difference()
{
translate([0, 0, -Cover_B_T])
union()
{
Bottom_Plate(Alternative);
translate([0, 0, -1])
for (i = [0:3]) {
translate(Mounting_Holes[i]) cylinder(h=1, d=Screw_Ring_M3_Outer_Diameter, center=false, $fn = $preview ? 32 : 100);
}
translate([0, 0, -1-Ring_M3_H]) Screw_Rings_M3();
}
for (i = [0:3]) {
// translate([0, 0, -Cover_B_T/2]) translate(Mounting_Holes[i])
// scale(1.1) Screw_Area_Cutout(Screw_Area_Cutout_Widths[i], Screw_Area_Cutout_Offsets[i], Cover_B_T/2);
translate([0, 0, -Cover_B_T/2]) Screw_Area_Stripe(Mounting_Holes[i][1], Cover_B_T/2, 1.1, 1.5);
}
Screw_Holes_M3();
translate([0, PCB_H/2 + 4, 0]) Bottom_Zip_Cutout(PCB_W/3);
}
}
}
module Bottom_Wall(Alternative)
{
Wall_H = Alternative == false ? Wall_B_H : Wall_B_H + Cover_B_T;
translate([PCB_W/2, PCB_H/2, -Wall_H/2])
difference()
{
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, 1*Wall_H], 2, true, $fn = $preview ? 32 : 100);
translate([0, 0, Wall_B_H/2-0.001])
cube([PCB_W + 1*Cover_O, PCB_H + 1*Cover_O, 1*Wall_B_H], center=true);
translate([0, 0, -Wall_B_H/2])
cube([PCB_W - 0.0*Cover_O, PCB_H - 0.0*Cover_O, 1*Wall_B_H], center=true);
}
translate([0, PCB_H/2 + 4, -Spacer_Bot_Height - PCB_T/2])
Bottom_Zip_Guide(3);
translate([0, 0, -Wall_B_H])
difference()
{
union()
{
for (i = [0:3]) {
// translate([0, 0, -Cover_B_T/2]) translate(Mounting_Holes[i])
// Screw_Area_Cutout(Screw_Area_Cutout_Widths[i], Screw_Area_Cutout_Offsets[i], Cover_B_T/2);
translate([0, 0, -Cover_B_T/2]) Screw_Area_Stripe(Mounting_Holes[i][1], Cover_B_T/2, 1, 1);
}
}
Screw_Holes_M3();
}
// USB Cover
translate([-3*Cover_O/4, 33, PCB_T/2]) cube([Cover_O/2, 9, PCB_T], center=true);
// Strip Cover at the front
Relief_Wall_X = Cable_Relief_Holder[1][0] - Cable_Relief_Holder[0][0] + Screw_Ring_M3_Outer_Diameter-1;
Relief_Wall_Z = 8.5;
translate([Cable_Relief_Holder[0][0], PCB_H, 0])
translate([Relief_Wall_X/2 - Screw_Ring_M3_Outer_Diameter/2 + 0.5, 3*Cover_O/4, Relief_Wall_Z/2]) cube([Relief_Wall_X, Cover_O/2, Relief_Wall_Z], center=true);
// Button Cover
translate([PCB_W + 3*Cover_O/4, Button[1], PCB_T/2]) cube([Cover_O/2, 7, PCB_T], center=true);
// Power Plug Cover
translate([PCB_W + 3*Cover_O/4, Power_Plug[1], PCB_T/2]) cube([Cover_O/2, 9, PCB_T], center=true);
}
module Bottom_Plate(Alternative)
{
translate([PCB_W/2, PCB_H/2, Cover_B_T/2])
if(Alternative == false)
{
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, Cover_B_T], 2, true, $fn = $preview ? 32 : 100);
}
else
{
roundedBox([PCB_W - 0.25*Cover_O, PCB_H - 0.25*Cover_O, Cover_B_T], 1, true, $fn = $preview ? 32 : 100);
}
}
module Bottom_Zip_Guide(Cube_Height)
{
translate([PCB_W/2, 5, 0])
{
difference()
{
translate([0, -5, Cube_Height/2]) cube([PCB_W + 2*Cover_O, 10, Cube_Height], center=true);
translate([0, -5, -1]) rotate([0, 90, 90]) oval_prism(12, 17.4, 3.5, center=true, $fn = $preview ? 32 : 100);
}
}
}
module Bottom_Zip_Cutout(Center_Offset)
{
Width = 3;
Height = 10;
translate([PCB_W/2 - Center_Offset, 0, 0]) rotate([0,+45, 0]) cube([Width, Height, 100], center=true);
translate([PCB_W/2 + Center_Offset, 0, 0]) rotate([0,-45, 0]) cube([Width, Height, 100], center=true);
}
module MIDI_Plug_Cutout()
{
union()
{
translate([0, -10/2, 0]) cube([18.5, 10+0.0, 2*Cover_T_T], center=true);
translate([0, -(10+10/2), 0]) cube([22.5, 10+0.1, 2*Cover_T_T], center=true);
translate([0, 2/2, 0]) cube([11.0, 2+0.1, 2*Cover_T_T], center=true);
translate([0, 4/2, 0]) cube([ 3.5, 2+0.1, 2*Cover_T_T], center=true);
}
}
module MIDI_Plug_Arc()
{
MIDI_Plug_Arc_Base(9, false);
difference() {
translate([0, -eps, 0])
intersection() {
translate([0, 4.5, 0]) MIDI_Plug_Arc_Base(4.5, true);
rotate([0, 90, 0]) oval_prism(20.5, 5, 8, center=true, $fn = $preview ? 32 : 100);
// hull() {
// rotate([ 0, 0, 0]) MIDI_Plug_Arc_Base(0.1);
// rotate([-90, 0, 0]) scale([1, 1, 0.6]) MIDI_Plug_Arc_Base(0.1);
// }
//
}
MIDI_Plug_Cutout();
}
}
module MIDI_Plug_Arc_Base(height, filled)
{
difference()
{
rotate([90, 0, 0]) {
if(filled==true) {
oval_prism(height, 18.5/2-1.25, 10.2, $fn = $preview ? 32 : 100);
}
if(filled==false) {
oval_tube(height, 18.5/2 + 1, 8, 1, $fn = $preview ? 32 : 100);
}
}
translate([0, -height/2+0.01, -5]) cube([40, 2*height, 10], center=true);
}
}