Stacked Plexiglass Enclosure Case Using OpenSCAD

by jimk3038 in Workshop > CNC

5955 Views, 32 Favorites, 0 Comments

Stacked Plexiglass Enclosure Case Using OpenSCAD

DSCN3879c.JPG
DSCN3919.JPG
Case.png
DSCN3882.JPG
DSCN3866.JPG
DSCN3870.JPG
DSCN3876.JPG
It all started the other day when I had to stay home with my kids on a school snow day.  Seemed like half the neighborhood ended up at our house!  Anyway, was a real good excuse for my to learn something new that day.

This instructable will show you how to make a stacked Plexiglas enclosure using OpenSCAD.  The enclosures I've built so far have used three pieces of 3/16" Plexiglas for the core slices.  The two cover pieces were made out of 1/8" Plexiglas.  Once assembled, the enclosure is really really rugged and tough.  Could run over the darn thing with a truck!

OpenSCAD is a kinda strange, in that, the model is built using a Python like language.  Kinda like Python but not really.  There are a bunch of strange restrictions like all variables are defined at compile-time.  Seemed strange to me.  There is no provision to edit the model using a GUI interface.  The GUI interface is just for viewing the model after it has been generated.

On the upside, OpenSCAD lets you whip around models by changing variables in your script.  Once variables have been updated, just save the file and OpenSCAD will regenerate the new model.  Basically, parametric modeling on steroids.

Once the model's source code parameters have been adjusted to your liking, OpenSCAD can be used to make a 2D "projection" of each piece onto the X/Y plane.  With the 2D projection done, a menu option can be used to save the 2D part outline to a DXF file.  Once saved as DXF, the DXF part file can be used on a laser cutter to actually cut the part.

Generating an Enclosure With OpenSCAD

drawing.jpg
i3.png
Case.png
i4.png
i6.png
i2.png
i1.png
i5.png
i8.png
i7.png
In this step I'm going to assume you have OpenSCAD installed on your machine.  If not, you can visit OpenSCAD.org and download and install the software.

Attached below is a Zip file with two files inside that are needed to generate a Stacked Plexiglas Enclosure.  Unzip both files into a directory.  Next, start OpenSCAD and read in the file "Stacked_Box.scad".  Note, at the beginning of the Stacked_Box.scad is an include statement that reads the other needed file "utils.scad".  As soon as Stacked_Box.scad is read into OpenSCAD the GUI side of OpenSCAD should display the model within a second, or two.  No other library files are needed for this model.

With the model displayed within OpenSCAD, use your mouse to spin the model around on the screen.  The mouse wheel zooms in, and out, while the right mouse button lets you pan the model.  For some reason, kids really get a kick out of spin the model.

Below is just a bunch of different images taken using the OpenSCAD menu option "Design/Export as image...".  The export image menu option generates a PNG type image.  When the export image dialog box opens, make sure you tact a ".png" on the end of your filename otherwise you will get a PNG image without a ".PNG" extension on the filename.

Changing / Adjusting Parameters

Exploded.png
Lid.png
OK, now heres the really fun part!

Simply change a parameter near the top of the source code and update the model.  If your using the built-in editor in OpenSCAD, just press F5 to regenerate the model.  If your using an external editor, like me, make sure "Design/Automatic Reload and Compile" is check marked.  With auto reload turned on, as soon as an external editor re-saves the file OpenSCAD will regenerate the model.  I also put a check mark on the menu option "View/Hide editor".  Note, when you uncheck this option you need to drag out the editor window into the GUI area - not very intuitive.

Below is a video that shows OpenSCAD in action.  I tried to use a really large font inside the editor.  However, for best viewing, make sure you watch the video using HD.  Oh, and don't forget to try setting the variable "ex" from zero to something like 10.  This variable, when not set to zero, causes the enclosure to be displayed in an exploded style view.  Each piece is separated by the amount you set in "ex".

Right now this instructable has the most up to date info.  However, in the future I'll post some more pictures on my web site of different size enclosures I plan to build.  So, in the coming months keep an eye on:  http://ph-elec.com/archives/openscad-stacked-plexiglass-enclosure/

Now, be nice - this is my first OpenSCAD model and YouTube video of same. 

Hope this helps,
Jim