209 lines
9.2 KiB
OpenSCAD
209 lines
9.2 KiB
OpenSCAD
//-----------------------------------------------------------------------
|
|
// Yet Another Parameterized Projectbox generator
|
|
//
|
|
// This is a box for <template>
|
|
//
|
|
// Version 3.0.1 (2024-01-15)
|
|
//
|
|
// This design is parameterized based on the size of a PCB.
|
|
//
|
|
// For many/complex cutoutGrills, you might need to adjust
|
|
// the max number of elements in OpenSCAD:
|
|
//
|
|
// Preferences->Advanced->Turn off rendering at 250000 elements
|
|
// ^^^^^^
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
|
|
include <../YAPPgenerator_v3.scad>
|
|
|
|
//---------------------------------------------------------
|
|
// This design is parameterized based on the size of a PCB.
|
|
//---------------------------------------------------------
|
|
// Note: length/lengte refers to X axis,
|
|
// width/breedte refers to Y axis,
|
|
// height/hoogte refers to Z axis
|
|
|
|
/*
|
|
padding-back|<------pcb length --->|<padding-front
|
|
RIGHT
|
|
0 X-axis --->
|
|
+----------------------------------------+ ---
|
|
| | ^
|
|
| | padding-right
|
|
Y | | v
|
|
| | -5,y +----------------------+ | ---
|
|
B a | | 0,y x,y | | ^ F
|
|
A x | | | | | R
|
|
C i | | | | | pcb width O
|
|
K s | | | | | N
|
|
| | 0,0 x,0 | | v T
|
|
^ | -5,0 +----------------------+ | ---
|
|
| | | padding-left
|
|
0 +----------------------------------------+ ---
|
|
0 X-as --->
|
|
LEFT
|
|
*/
|
|
|
|
|
|
//-- which part(s) do you want to print?
|
|
printBaseShell = true;
|
|
printLidShell = true;
|
|
printSwitchExtenders = false;
|
|
|
|
|
|
// ********************************************************************
|
|
// The Following will be used as the first element in the pbc array
|
|
pcbLength = 100; // Front to back
|
|
pcbWidth = 20; // Side to side
|
|
pcbThickness = 1.6;
|
|
standoffHeight = 10.0; //-- How much the PCB needs to be raised from the base to leave room for solderings and whatnot
|
|
standoffDiameter = 7;
|
|
standoffPinDiameter = 2.4;
|
|
standoffHoleSlack = 0.4;
|
|
|
|
//===================================================================
|
|
// *** PCBs ***
|
|
// Printed Circuit Boards
|
|
//-------------------------------------------------------------------
|
|
// Default origin = yappCoordPCB : yappCoordBoxInside[0,0,0]
|
|
//
|
|
// Parameters:
|
|
// Required:
|
|
// p(0) = name
|
|
// p(1) = length
|
|
// p(2) = width
|
|
// p(3) = posx
|
|
// p(4) = posy
|
|
// p(5) = Thickness
|
|
// p(6) = standoffHeight
|
|
// p(7) = standoffDiameter
|
|
// p(8) = standoffPinDiameter
|
|
// p(9) = standoffHoleSlack (default to 0.4)
|
|
// Optional:
|
|
|
|
//The following can be used to get PCB values elsewhere in the script - not in pcb definition.
|
|
//If "PCB Name" is omitted then "Main" is used
|
|
// pcbLength --> pcbLength("PCB Name")
|
|
// pcbWidth --> pcbWidth("PCB Name")
|
|
// pcbThickness --> pcbThickness("PCB Name")
|
|
// standoffHeight --> standoffHeight("PCB Name")
|
|
// standoffDiameter --> standoffDiameter("PCB Name")
|
|
// standoffPinDiameter --> standoffPinDiameter("PCB Name")
|
|
// standoffHoleSlack --> standoffHoleSlack("PCB Name")
|
|
|
|
pcb =
|
|
[
|
|
["Main", pcbLength,pcbWidth, 0,0, pcbThickness, standoffHeight, standoffDiameter, standoffPinDiameter, standoffHoleSlack]
|
|
];
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
//-- padding between pcb and inside wall
|
|
paddingFront = 1;
|
|
paddingBack = 1;
|
|
paddingRight = 1;
|
|
paddingLeft = 1;
|
|
|
|
//-- Edit these parameters for your own box dimensions
|
|
wallThickness = 2.4;
|
|
basePlaneThickness = 1.2;
|
|
lidPlaneThickness = 1.2;
|
|
|
|
//-- Total height of box = lidPlaneThickness
|
|
// + lidWallHeight
|
|
//-- + baseWallHeight
|
|
// + basePlaneThickness
|
|
//-- space between pcb and lidPlane :=
|
|
//-- (bottonWallHeight+lidWallHeight) - (standoffHeight+pcbThickness)
|
|
baseWallHeight = 9;
|
|
lidWallHeight = 17;
|
|
|
|
//-- ridge where base and lid off box can overlap
|
|
//-- Make sure this isn't less than lidWallHeight
|
|
ridgeHeight = 5.0;
|
|
ridgeSlack = 0.2;
|
|
roundRadius = 3.0;
|
|
|
|
// Set the layer height of your printer
|
|
printerLayerHeight = 0.2;
|
|
|
|
//---------------------------
|
|
//-- C O N T R O L --
|
|
//---------------------------
|
|
// -- Render --
|
|
renderQuality = 8; //-> from 1 to 32, Default = 8
|
|
|
|
// --Preview --
|
|
previewQuality = 5; //-> from 1 to 32, Default = 5
|
|
showSideBySide = false; //-> Default = true
|
|
onLidGap = 10; // tip don't override to animate the lid opening
|
|
colorLid = "YellowGreen";
|
|
alphaLid = 1;
|
|
colorBase = "BurlyWood";
|
|
alphaBase = 1;
|
|
hideLidWalls = false; //-> Remove the walls from the lid : only if preview and showSideBySide=true
|
|
hideBaseWalls = false; //-> Remove the walls from the base : only if preview and showSideBySide=true
|
|
showOrientation = true; //-> Show the Front/Back/Left/Right labels : only in preview
|
|
showPCB = false; //-> Show the PCB in red : only in preview
|
|
showSwitches = true; //-> Show the switches (for pushbuttons) : only in preview
|
|
showButtonsDepressed = false; //-> Should the buttons in the Lid On view be in the pressed position
|
|
showOriginCoordBox = false; //-> Shows red bars representing the origin for yappCoordBox : only in preview
|
|
showOriginCoordBoxInside = false; //-> Shows blue bars representing the origin for yappCoordBoxInside : only in preview
|
|
showOriginCoordPCB = false; //-> Shows blue bars representing the origin for yappCoordBoxInside : only in preview
|
|
showMarkersPCB = false; //-> Shows black bars corners of the PCB : only in preview
|
|
showMarkersCenter = false; //-> Shows magenta bars along the centers of all faces
|
|
inspectX = 0; //-> 0=none (>0 from Back)
|
|
inspectY = 13.5; //-> 0=none (>0 from Right)
|
|
inspectZ = 0; //-> 0=none (>0 from Bottom)
|
|
inspectXfromBack = true; //-> View from the inspection cut foreward
|
|
inspectYfromLeft = true; //-> View from the inspection cut to the right
|
|
inspectZfromBottom = true; //-> View from the inspection cut up
|
|
//---------------------------
|
|
//-- C O N T R O L --
|
|
//---------------------------
|
|
|
|
//===================================================================
|
|
// *** PCB Supports ***
|
|
// Pin and Socket standoffs
|
|
//-------------------------------------------------------------------
|
|
// Default origin = yappCoordPCB : pcb[0,0,0]
|
|
//
|
|
// Parameters:
|
|
// Required:
|
|
// p(0) = posx
|
|
// p(1) = posy
|
|
// Optional:
|
|
// p(2) = Height to bottom of PCB : Default = standoff_Height
|
|
// p(3) = PCB Gap : Default = -1 : Default for yappCoordPCB=pcb_Thickness, yappCoordBox=0
|
|
// p(4) = standoff_Diameter Default = standoff_Diameter;
|
|
// p(5) = standoff_PinDiameter Default = standoff_PinDiameter;
|
|
// p(6) = standoff_HoleSlack Default = standoff_HoleSlack;
|
|
// p(7) = filletRadius (0 = auto size)
|
|
// p(8) = Pin Length : Default = 0 -> PCB Gap + standoff_PinDiameter
|
|
// Indicated length of pin without the half sphere on top
|
|
// n(a) = { <yappBoth> | yappLidOnly | yappBaseOnly }
|
|
// n(b) = { <yappPin>, yappHole, yappTopPin }
|
|
// yappPin = Pin on Base and Hole on Lid
|
|
// yappHole = Hole on Both
|
|
// yappHole = Hole on Base and Pin on Lid
|
|
// n(c) = { yappAllCorners, yappFrontLeft | <yappBackLeft> | yappFrontRight | yappBackRight }
|
|
// n(d) = { <yappCoordPCB> | yappCoordBox | yappCoordBoxInside }
|
|
// n(e) = { yappNoFillet } : Removes the internal and external fillets and the Rounded tip on the pins
|
|
// n(f) = [yappPCBName, "XXX"] : {Specify a PCB defaults to "Main"
|
|
//-------------------------------------------------------------------
|
|
pcbStands =
|
|
[
|
|
[5, 10, undef, undef, 2, 1] // Original method
|
|
,[15, 10, undef, undef, 4, 2, undef, undef, pcbThickness() + 2 ] // Custom Length of PCB Thickness + 2
|
|
,[25, 10, undef, undef, 4, 2, undef, undef, 999 , yappHole] // Default Hole in Lid and Pin in Base Pin Length is ignored
|
|
,[35, 10, undef, undef, 4, 2, yappHole] // Default Hole in Lid and Pin in Base Pin Length is ignored
|
|
,[45, 10, undef, undef, 4, 2, undef, undef, pcbThickness() +2 , yappTopPin] // Hole in Base and Pin in Lid
|
|
,[55, 10, undef, undef, 4, 2, undef, undef, pcbThickness() +2 , yappNoFillet] // No Outer Fillet
|
|
,[65, 10, undef, undef, 4, 2, undef, undef, 4 ] // Custom Length of 4
|
|
,[75, 10, undef, undef, 4, 2, undef, undef, -0.0001 ] // Custom Length of Zero (have to use 0.0001 so it's not actually zero so the default isn't used
|
|
];
|
|
|
|
//---- This is where the magic happens ----
|
|
YAPPgenerate();
|