/YAPP_Box

Yet Another Parametric Projectbox Box

Primary LanguageOpenSCADMIT LicenseMIT

YAPP_Box

Yet Another Parametric Projectbox generator

You can find the complete and official documentation here

If you have questions please place them in a comment at the "Yet Another Parametric Projectbox generator" (English) or at the "Nog een geparametriseerde projectbox generator" (Dutch).


Rev. 2.0 (21-05-2023)

New functionality lightTubes (experimental)

With the lightTubes array you can define where you want tubes for LED's and NeoPixles**

//-- lightTubes  -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = tubeLength
// (3) = tubeWidth
// (4) = tubeWall
// (5) = abovePcb
// (6) = tubeType  {yappCircle|yappRectangle}
lightTubes = [
              //--- 0,    1, 2, 3, 4, 5, 6
                  [84.5, 21, 3, 6, 1, 4, yappRectangle]
                , [30,   21, 5, 0, 1, 2, yappCircle]
              ];     

lightTube_top lightTube_a

posx        - the position of the center of the led on the X-axes of the PCB
posy        - the position of the center of the led on the Y-axes of the PCB
tubeLength  - the length of the tube (if yappRectangle) or the diameter of the tube (if yappCircle)
tubeWidth   - the width of the tube (not used if yappCircle)
tubeWall    - the width of the wall around the led
abovePcp    - how hight the tube will begin with respect to the top of the PCB
tubeType    - whether the led shows as a circle (yappCircle) or a rectangle (yappRectangle)

New functionality pushButtons (experimental)

With the pushButtons array you can define where you want button guides for tactile switches.

//-- pushButtons  -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = capLength
// (3) = capWidth
// (4) = capAboveLid
// (5) = switchHeight
// (6) = switchTrafel
// (7) = poleDiameter
// (8) = buttonType  {yappCircle|yappRectangle}
pushButtons = [
                 [15, 30, 8, 8, 0, 1,   1, 3.5, yappCircle]
               , [15, 10, 8, 6, 2, 4.5, 1, 3.5, yappRectangle]
              ];

buttonGuides

The "Plate" has to be glued to the "Pole".

posx         - the position of the center of the tacktile switch on the PCB
posy         - the position of the center of the tacktile switch on the PCB
capLength    - the length of the button (if yappRectangle) or the diameter (if yappCircle)
capWidth     - the width of the button (if yappRectangle, otherwise ignored)
capAboveLid  - how much the button cap is above the lid
switchHeight - the height of the tactile switch
switchTrafel - the distance the button has to trafel to activate the tacktile switch
poleDiameter - the diameter of the pole that connects the button cap with the plate
buttonType   - either yappCircle or yappRectangle

Rev. 1.8 (22-02-2023)

This version breaks with the API for the following array's:

  • pcbStand[..] (extra parameter for standoffHeight)
  • connectors[..] (extra parameter for baseConnector Height)
//-- pcb_standoffs  -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = standoffHeight
// (3) = flangeHeight
// (4) = flangeDiameter
// (5) = { yappBoth | yappLidOnly | yappBaseOnly }
// (6) = { yappHole, YappPin }
// (7) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
pcbStands = [
                [3,  3, 5, 3, 11, yappBoth, yappPin, yappAllCorners]
               ,[5,  5, 5, 4, 10, yappBoth, yappPin, yappBackLeft, yappFrontRight]
               ,[8,  8, 5, 4, 11, yappBoth, yappPin]
               ,[pcbLength-15, pcbWidth-15, 8, 4, 12, yappBoth, yappPin]
             ];
//-- connectors
//-- normal         : origen = box[0,0,0]
//-- yappConnWithPCB: origen = pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = pcbStandHeight
// (3) = screwDiameter
// (4) = screwHeadDiameter
// (5) = insertDiameter
// (6) = outsideDiameter
// (7) = flangeHeight
// (8) = flangeDiam
// (9) = { yappConnWithPCB }
// (10) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
connectors   =  [
                    [ 8,  8, 5, 2.5, 2.8, 3.8, 6, 6, 15, yappAllCorners]
                  , [28, 58, 5, 2.5, 2.8, 3.8, 6, 6, 25, yappConnWithPCB]
                ];


Rev. 1.7

This version breaks with the API for the following array's:

  • pcbStand[..] (extra parameter for flange)
  • connectors[..] (huge change lots of extra parameters)
  • connectosPCB[..] (removed)
//-- pcb_standoffs  -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = flangeHeight
// (3) = flangeDiameter
// (4) = { yappBoth | yappLidOnly | yappBaseOnly }
// (5) = { yappHole, YappPin }
// (6) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
pcbStands = [
                [3,  3, 3, 11, yappBoth, yappPin, yappAllCorners]
               ,[5,  5, 4, 10, yappBoth, yappPin, yappBackLeft, yappFrontRight]
               ,[8,  8, 4, 11, yappBoth, yappPin]
               ,[pcbLength-15, pcbWidth-15, 4, 12, yappBoth, yappPin]
             ];
//-- connectors
//-- normal         : origen = box[0,0,0]
//-- yappConnWithPCB: origen = pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = screwDiameter
// (3) = screwHeadDiameter
// (4) = insertDiameter
// (5) = outsideDiameter
// (6) = flangeHeight
// (7) = flangeDiam
// (8) = { yappConnWithPCB }
// (9) = { yappAllCorners | yappFrontLeft | yappFrondRight | yappBackLeft | yappBackRight }
connectors   =  [
                    [8, 8, 2.5, 2.8, 3.8, 6, 6, 15, yappAllCorners]
                  , [28, 58, 2.5, 2.8, 3.8, 6, 6, 25, yappConnWithPCB]
                ];

The depth of the screw in the connectors is now depending on the standoffHeight so the screw size does not change anymore. YAPP_connectorRevised


Rev. 1.6

  • new cutoutGrills array
//-- cutoutGrills    -- origin is box[x0,y0]
// (0) = xPos
// (1) = yPos
// (2) = grillWidth
// (3) = grillLength
// (4) = gWidth
// (5) = gSpace
// (6) = gAngle
// (7) = plane [ "base" | "lid" ]
// (8) = {polygon points} (optional)


cutoutGrills = [
                 [22, 22, 90, 90, 2, 3, 50, "base", [  [0,15],[20,15],[30,0],[40,15],[60,15]
                                                      ,[50,30],[60,45], [40,45],[30,60]
                                                      ,[20,45], [0,45],[10,30] ]
                 ]
                ,[15, 10, 50, 10, 2, 3, -20, "base"]
                ,[15, 15, 10, 50, 2, 3, -45, "lid"]
                ,[15, 85, 50, 10, 2, 3,  20, "base"]
                ,[85, 15, 10, 50, 2, 3,  45, "lid"]
               ];

cutoutGrills-v16

Be aware: this functionality needs a huge amount of rendering elements.

You can set this at Preferences->Advanced->Turn of rendering at 100000 elements


Rev. 1.5

  • Various bug-fixes
  • Connectors now have a flange at the basePlane and lidPlane for a better adhesion

This release breaks with previous releases in the extra parm "depth" in the labels array!!

The labels now have this syntax:

//-- origin of labels is box [0,0,0]
// (0) = posx
// (1) = posy/z
// (2) = orientation
// (3) = depth
// (4) = plane {lid | base | left | right | front | back }
// (5) = font
// (6) = size
// (7) = "label text"

Example:

labelsPlane = [
                [10,  10,   0, 0.6, "lid",   "Liberation Mono:style=bold", 15, "YAPP" ]
               ,[100, 90, 180, 0.8, "base",  "Liberation Mono:style=bold", 11, "Base" ]
               ,[8,    8,   0, 1.0, "left",  "Liberation Mono:style=bold",  7, "Left" ]
               ,[10,   5,   0, 1.2, "right", "Liberation Mono:style=bold",  7, "Right" ]
               ,[40,  23,   0, 1.5, "front", "Liberation Mono:style=bold",  7, "Front" ]
               ,[5,    5,   0, 2.0, "back",  "Liberation Mono:style=bold",  8, "Back" ]
              ];

For your box to work with this release as before you have to add this extra parm (as "wallThickness/2", "basePlaneThickness/2" or "lidPlaneThickness/2").

Thanks to Keith Hadley

There now is a new array for connectors that holds the PCB. This array is called "connectorsPCB".

//-- connectorsPCB -- origin = pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = screwDiameter
// (3) = insertDiameter
// (4) = outsideDiameter
// (5) = { yappAllCorners }

Example:

connectorsPCB = [
                  [pcbLength/2, 10, 2.5, 3.8, 5]
                 ,[pcbLength/2, pcbWidth-10, 2.5, 3.8, 5]
                ];

It takes in account the "pcbThickness" to calculate the hight of the lid-connector.

Thanks to Oliver Grafe

connectorTypes


Rev. 1.4

This release breaks with previous releases in the extra parm "angle" in all the cutouts array's!!!

All plane array's now have this syntax:

//-- plane    -- origin is pcb[0,0,0]
// (0) = posx
// (1) = posy
// (2) = width
// (3) = length
// (4) = angle
// (5) = { yappRectangle | yappCircle }
// (6) = { yappCenter }

For your box to work with this release you have to add this extra parm (as "0") to all your cutOut-array-row's

THIS IS WORK IN PROGRESS!!

See: This Post (English) or This Post (in Dutch)


I have done my best but it can probably be done simpler. So, if you think you can help please contact me or make a Merge Request.

TO DO

  • I want rounded corners! Do you have an idear howto do that?? (done)
  • modules (Hooks) that can be (re)defined by the user (almost there ;-)) (done)
  • screw connector between the top- and bottomPlanes (for bigger boxes) (done)
  • snap-ons in the ridges (done)
  • Rotate rectangular cutOuts (orientation) v1.4
  • Connectors that holds the PCB in place v1.5 (Oliver Grafe)
  • Variable depth of labels v1.5 (Keithe Hadley)
  • anything else? Anyone?

How to program your Project Box

It all starts with some dimensions of the pcb you want your Project Box for and some other dimensions:

printBaseShell      = true;
printLidShell       = true;

// Edit these parameters for your own board dimensions
wallThickness       = 1.0;
basePlaneThickness  = 1.0;
lidPlaneThickness   = 1.0;

// Total height of box = basePlaneThickness + lidPlaneThickness 
//                     + baseWallHeight + lidWallHeight

baseWallHeight      = 7;
lidWallHeight       = 4;

pcbLength           = 88;
pcbWidth            = 49;
pcbThickness        = 1.5;
                            
// padding between pcb and inside wall
paddingFront        = 4;
paddingBack         = 1;
paddingRight        = 1;
paddingLeft         = 1;

// ridge where Base- and Lid- off the box can overlap
// Make sure this isn't less than lidWallHeight
ridgeHeight         = 3;
ridgeSlack          = 0.2;
roundRadius         = 2.0;  // don't make this to big..

//-- How much the PCB needs to be raised from the base
//-- to leave room for solderings and whatnot
standoffHeight      = 5.0;
pinDiameter         = 1.0;
pinHoleSlack        = 0.5;
standoffDiameter    = 4;

You probably want some cutouts in your box for connectors and stuff. For every plane (side) of the Project Box there is an array that holds the cutouts for that plane.

These examples are made with Rev. 1.3!

For Rev. 1.4 to work you need to add the extra parm angle in all cutouts array's!!

A picture is worth a thousand words ...

cutouts in the Right Plane:

YAPP_cutoutsRight

cutouts in the Left Plane:

YAPP_cutoutsLeft

cutouts in the Back Plane:

YAPP_cutoutsBack

cutouts in the Front Plane:

YAPP_cutoutsFront

cutouts in the Base:

YAPP_cutoutsBase

cutouts in the Lid:

YAPP_cutoutsLid

Using the (new) angle parm (rotate around the x/y corner):

yappRectangle40dgrs

With yappCenter the rectangle will rotate around it's center point:

yappRectangleCenter10dgrs

Base mounts:

Screenshot 2022-01-25 at 11 25 46

pcbStands:

pcbStands fixate the PCB between the base and the lid. YAPP_pcbStands

Connectors between Base and Lid:

YAPP_connectors

ConnectorsPCB between Base and Lid that fixates the PCB:

connectorTypes

YAPP_connector_D

Inserts are great for making a screw connection between the base and the lid. Ruthex-insert-a

Thats it! Press F5 or F6 to see the results of your work!

Snap Joins:

snapJoins1

snapJoins2

Snap Joins Symmetrical:

snapJoinsSymetric

(more) Base Mounts:

yappBaseStand

yappBaseStand3D

Hooks:

There are two type of "hooks"; at the inside of the box or at the outside of the box

baseHookOutside():

baseHookOutside

baseHookOutside3D

lidHookInside():

lidHooksInside1

lidHooksInside3Db

lidHooksInside3Da


Buy me a coffee (please)!

If you like this project or it saved you time, you can give me a cup of coffee :)

bmc-button-75