348 lines
8.6 KiB
OpenSCAD
348 lines
8.6 KiB
OpenSCAD
use <MCAD/boxes.scad>
|
|
use <MCAD/regular_shapes.scad>
|
|
|
|
|
|
use <MIDI_Lighter_Mic_Adapter.scad>
|
|
include <RP2350_MIDI_Lighter_PCB.scad>
|
|
include <RP2350_MIDI_Lighter_Definition.scad>
|
|
|
|
|
|
Show_FAD_Logo = false;
|
|
Show_PCB = false;
|
|
Debug_Present = true;
|
|
$preview = false;
|
|
|
|
|
|
|
|
if(Show_PCB)
|
|
{
|
|
PCB();
|
|
translate([0,0,+PCB_T/2]) Spacer_Top();
|
|
translate([0,0,-PCB_T/2]) Spacer_Bot();
|
|
}
|
|
|
|
// Only for display purposes
|
|
// translate([0, 0, eps])
|
|
|
|
// Top();
|
|
Top_Wall(1);
|
|
// Bottom();
|
|
// rotate([0, 180, 0])
|
|
// Display_GC9A01A_Cover();
|
|
|
|
|
|
|
|
|
|
module Display_GC9A01A_Cover()
|
|
{
|
|
color([0.4, 1.0, 0.4], 1.0)
|
|
translate([0, 0, +Spacer_Top_Height + PCB_T/2 + Cover_T_T + 0.0])
|
|
difference()
|
|
{
|
|
translate(GC9A01A)
|
|
difference() {
|
|
GC9A01A_Cover_Plate(1.0, 1);
|
|
GC9A01A_Cover_Cutout(10);
|
|
}
|
|
Screw_Pits_M3(10);
|
|
}
|
|
}
|
|
|
|
|
|
module Top()
|
|
{
|
|
color([0.2, 0.8, 0.2])
|
|
difference()
|
|
{
|
|
translate([0, 0, +Spacer_Top_Height + PCB_T/2])
|
|
union()
|
|
{
|
|
difference()
|
|
{
|
|
union()
|
|
{
|
|
Top_Plate();
|
|
}
|
|
|
|
Screw_Holes_M3();
|
|
Top_Wall_Screw_Plates(0.6, -eps, true);
|
|
translate([0, 0, +Cover_T_T]) Screw_Pits_M3(1);
|
|
translate(Rotary_Encoder) Screw_Drill(7.5);
|
|
translate(GC9A01A) GC9A01A_Cutout(5*Cover_T_T);
|
|
|
|
translate([0, 0, +Cover_T_T])
|
|
{
|
|
translate([0, 0, -1.0]) // Penetration Depth
|
|
translate(Rotary_Encoder) cylinder(d=15, h=100, center=false, $fn = $preview ? 32 : 100);
|
|
|
|
translate([0, 0, -0.5]) // Penetration Depth
|
|
translate(GC9A01A) GC9A01A_Cover_Plate(10, 1.02);
|
|
}
|
|
|
|
translate([0, 0, -Spacer_Top_Height - PCB_T/2]) PCB_Cutouts_Top_Plate();
|
|
}
|
|
|
|
for (i = MIDI_Plugs) {
|
|
translate([0, 0, Cover_T_T]) translate(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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module Top_Plate()
|
|
{
|
|
Cover_O_Factor = 0.9;
|
|
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);
|
|
roundedBox([PCB_W + Cover_O_Factor*Cover_O, PCB_H + Cover_O_Factor*Cover_O, Cover_T_T], 1.0, true, $fn = $preview ? 32 : 100);
|
|
}
|
|
|
|
module Top_Wall(gallery_width = 1)
|
|
{
|
|
union()
|
|
{
|
|
difference()
|
|
{
|
|
union()
|
|
{
|
|
translate([PCB_W/2, PCB_H/2, +Wall_T_H/2])
|
|
difference() {
|
|
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, 1*Wall_T_H], 2, true, $fn = $preview ? 32 : 100);
|
|
cube([PCB_W + 1*Cover_O, PCB_H + 1*Cover_O, 2*Wall_T_H], center=true);
|
|
}
|
|
Top_Wall_Gallery(gallery_width);
|
|
}
|
|
|
|
|
|
|
|
translate([PCB_W/2, PCB_H/2, +Wall_T_H/2])
|
|
{
|
|
Top_Wall_Remove_Part("top", Wall_T_H-Cover_T_T/2, 10.5, MOLEX[0]);
|
|
Top_Wall_Remove_Part("bottom", 3.5, 10, Audio_Jack[0]);
|
|
Top_Wall_Remove_Part("right", 6.5, 3.5, Button[1]);
|
|
Top_Wall_Remove_Part("right", PCB_T/2+2.5, 16, USB_C[1]);
|
|
|
|
// Cutout for Debug Connector
|
|
if(Debug_Present) {
|
|
Top_Wall_Remove_Part("left", PCB_T/2+6, 7, 28.575);
|
|
}
|
|
}
|
|
PCB_Cutouts_Top_Wall();
|
|
}
|
|
|
|
Top_Wall_Screw_Plates(0.5, Spacer_Top_Height + PCB_T/2);
|
|
}
|
|
}
|
|
|
|
module Top_Wall_Remove_Part(wall_section, height, length, position)
|
|
{
|
|
Wall_T = Cover_O/2;
|
|
// Wall_XY = 0;
|
|
Wall_XY = wall_section == "right" ? +PCB_W/2+Cover_O/2+Wall_T/2 :
|
|
wall_section == "left" ? -PCB_W/2-Cover_O/2-Wall_T/2 :
|
|
wall_section == "top" ? +PCB_H/2+Cover_O/2+Wall_T/2 :
|
|
wall_section == "bottom"? -PCB_H/2-Cover_O/2-Wall_T/2 : 0;
|
|
|
|
if(wall_section == "right" || wall_section == "left")
|
|
{
|
|
translate([Wall_XY, position-PCB_H/2, -Wall_T_H/2+height/2 - eps])
|
|
cube([10*Wall_T, length, height], center=true);
|
|
}
|
|
else if(wall_section == "top" || wall_section == "bottom")
|
|
{
|
|
translate([position-PCB_W/2, Wall_XY, -Wall_T_H/2+height/2 - eps])
|
|
cube([length, 10*Wall_T, height], center=true);
|
|
}
|
|
}
|
|
|
|
module Top_Wall_Screw_Plates(height, height_offset, cutout=false)
|
|
{
|
|
Screw_Plate_Size = [
|
|
[10, 10, height],
|
|
[10, 8, height],
|
|
[ 0, 0, 0],
|
|
[10, 7, height],
|
|
[16, 7, height]
|
|
];
|
|
|
|
Screw_Plate_Offset = [
|
|
[-1, +1, height/2 + height_offset],
|
|
[+1, +2, height/2 + height_offset],
|
|
[ 0, 0, height/2 + height_offset],
|
|
[-1, 0, height/2 + height_offset],
|
|
[+4, 0, height/2 + height_offset]
|
|
];
|
|
|
|
for (i = [0:4]) {
|
|
translate(Mounting_Holes[i])
|
|
|
|
if(cutout) {
|
|
translate(Screw_Plate_Offset[i]) scale([1.1, 1.1, 1]) cube(Screw_Plate_Size[i], center=true);
|
|
}
|
|
else {
|
|
difference() {
|
|
translate(Screw_Plate_Offset[i]) roundedBox(Screw_Plate_Size[i], 1, true);
|
|
Screw_Drill(Drill_M3);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module Top_Wall_Gallery(gallery_width=1)
|
|
{
|
|
translate([PCB_W/2, PCB_H/2, PCB_T/2 + Spacer_Top_Height -1/2])
|
|
difference()
|
|
{
|
|
cube([PCB_W + 1*Cover_O, PCB_H + 1*Cover_O, 1], center=true);
|
|
cube([PCB_W + 1*Cover_O - 2*gallery_width, PCB_H + 1*Cover_O - 2*gallery_width, 2], center=true);
|
|
}
|
|
}
|
|
|
|
module Bottom()
|
|
{
|
|
color([0.8, 0.8, 0.0])
|
|
difference()
|
|
{
|
|
translate([0, 0, -Spacer_Bot_Height - PCB_T/2])
|
|
{
|
|
difference()
|
|
{
|
|
translate([0, 0, -Cover_B_T])
|
|
union()
|
|
{
|
|
difference()
|
|
{
|
|
Bottom_Plate();
|
|
translate([PCB_W/2, PCB_H/2, 0]) KandM_14510_Mount(1, true);
|
|
}
|
|
translate([0, 0, Cover_B_T-eps]) Bottom_Wall(1.0);
|
|
translate([PCB_W/2, PCB_H/2, 5.5]) KandM_14510_Mount();
|
|
}
|
|
|
|
Screw_Holes_M3();
|
|
translate([0, 0, -Cover_B_T]) mirror([0, 0, 1]) Screw_Pits_M3(1);
|
|
|
|
}
|
|
}
|
|
|
|
PCB_Cutouts_From_Bottom();
|
|
}
|
|
}
|
|
|
|
module Bottom_Wall(plate_transition = 1)
|
|
{
|
|
translate([PCB_W/2, PCB_H/2, +Wall_B_H/2])
|
|
difference()
|
|
{
|
|
union()
|
|
{
|
|
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, 1*Wall_B_H], 2, true, $fn = $preview ? 32 : 100);
|
|
|
|
Bottom_Wall_Add_Part("right" , PCB_T/2 , 9 , Power_Plug[1]-2.4);
|
|
Bottom_Wall_Add_Part("right" , PCB_T/2+2.5 , 3 , Button[1]);
|
|
Bottom_Wall_Add_Part("right" , PCB_T/2+2.0 , 16 , USB_C[1]);
|
|
Bottom_Wall_Add_Part("top" , PCB_T/2 , 10 , MOLEX[0]);
|
|
Bottom_Wall_Add_Part("bottom" , 3.2 , 9.5 , Audio_Jack[0]);
|
|
// Bottom_Wall_Add_Part("bottom" , PCB_T/2+2.5 , PCB_W-1 , PCB_W/2);
|
|
|
|
// for (i = MIDI_Plugs) {
|
|
// Bottom_Wall_Add_Part("bottom", PCB_T/2+Spacer_Top_Height, 22, i[0]);
|
|
// }
|
|
}
|
|
union()
|
|
{
|
|
hull()
|
|
{
|
|
translate([0, 0, +Wall_B_H/2 + plate_transition]) cube([PCB_W + 1*Cover_O, PCB_H + 1*Cover_O, 2*Wall_B_H], center=true);
|
|
translate([0, 0, -Wall_B_H/2-eps]) cube([PCB_W + 1*Cover_O - 2*plate_transition , PCB_H + 1*Cover_O - 2*plate_transition, eps], center=true);
|
|
}
|
|
translate([0, 0, eps-Wall_B_H]) cube([PCB_W + 1*Cover_O - 2*plate_transition , PCB_H + 1*Cover_O - 2*plate_transition, Wall_B_H], center=true);
|
|
}
|
|
}
|
|
}
|
|
|
|
module Bottom_Wall_Add_Part(wall_section, height, length, position)
|
|
{
|
|
Wall_T = Cover_O/2;
|
|
// Wall_XY = 0;
|
|
Wall_XY = wall_section == "right" ? +PCB_W/2+Cover_O/2+Wall_T/2 :
|
|
wall_section == "left" ? -PCB_W/2-Cover_O/2-Wall_T/2 :
|
|
wall_section == "top" ? +PCB_H/2+Cover_O/2+Wall_T/2 :
|
|
wall_section == "bottom"? -PCB_H/2-Cover_O/2-Wall_T/2 : 0;
|
|
|
|
if(wall_section == "right" || wall_section == "left")
|
|
{
|
|
translate([Wall_XY, position-PCB_H/2, Wall_B_H/2 + height/2 - eps])
|
|
cube([Wall_T, length, height], center=true);
|
|
}
|
|
else if(wall_section == "top" || wall_section == "bottom")
|
|
{
|
|
translate([position-PCB_W/2, Wall_XY, Wall_B_H/2 + height/2 - eps])
|
|
cube([length, Wall_T, height], center=true);
|
|
}
|
|
}
|
|
|
|
module Bottom_Plate()
|
|
{
|
|
translate([PCB_W/2, PCB_H/2, Cover_B_T/2])
|
|
roundedBox([PCB_W + 2*Cover_O, PCB_H + 2*Cover_O, Cover_B_T], 2, true, $fn = $preview ? 32 : 100);
|
|
|
|
}
|
|
|
|
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.3, 0]) MIDI_Plug_Arc_Base(4.3, true);
|
|
rotate([0, 90, 0]) oval_prism(20.5, 4, 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);
|
|
}
|
|
}
|