Getting Started

To use the YAPP API you need at a minimum the following:

include <./YAPPgenerator_v3.scad>
YAPPgenerate();

This assumes that the YAPPgenerator_v3.scad library file is in the same location as your script. If it is in another location update the "./" as needed to locate the library (see What you need).

These two lines of code will include the API and generate a box (in this case with all of the default settings).

While this will get you "a box" it won't get you "your box". To get "your box" you will need to add all of the options that you need.

The Simplest Project Box

The YAPPgenerator assumes a lot of default values that you should override to the needs of your project box. So in addition to the two lines that are always needed you have to tell the YAPPgenerator the specifics of "your box".

First of all the YAPPgenerator needs the length, width and the thickness of the Printed Circuit Board (PCB) to calculate the size of the project box.

/*
**  The Simplest Project Box
**  The YAPPgenerator.scad library is in the 
**  project box folder
*/

include <YAPPgenerator_v3.scad>

pcbLength     = 40;
pcbWidth      = 30;
pcbThickness  =  2;

YAPPgenerate();

This will result in this project box:

The Lid (green) will fit nicely over the Base (brown). But it would be nice if the Lid snaps on to the Base so it won't come off easily.

Thats where snap joins come in handy.

By simply adding the following array to the code (actually snapJoins is an array that, in this example, has two elements in it that both ara also array's):

//  *** Snap Joins ***
snapJoins   =   
[
    [6, 5, yappLeft, yappRight]
   ,[pcbLength-6, 5, yappLeft, yappRight]
];

The first element tells the YAPPgenerator to add a snap-join with a length of 5mm at 6mm from the back of the box to both the left and right of the box. The second element tells the YAPPgenerator to add a snap-join of also 5mm at 'pcbLength-6' or '40-6' or 34mm from the back (which is 6mm from the front) and also at the left and the right of the box. The resulting box looks like this:

The snapJoins will click in each other and keep the Lid firmly connected with the Base.

Next we like to have control over the height of the Lid and Base. You can do that by adding the next two lines of code:

lidWallHeight  = 10;
baseWallHeight = 15;

The inside height of the project box will now be 25mm.

The complete code to generate the above project box:

/*
**  The Simplest Project Box
**  The YAPPgenerator.scad library is in the 
**  project box folder
*/

include <YAPPgenerator_v3.scad>

pcbLength      = 40;
pcbWidth       = 30;
pcbThickness   =  2;

lidWallHeight  = 10;
baseWallHeight = 15;

snapJoins   =   
[
    [6, 5, yappLeft, yappRight]
   ,[pcbLength -6, 5, yappLeft, yappRight]
];

YAPPgenerate();

To make use of all the available options of the YAPPgenerator you best read the rest of this document and use the YAPP_Template.scad file as a boilerplate (just remove everything you don't need).

Last updated