Version 3.3.1 updated updated Sep 24, 2018.
This was originally a simple modification to https://www.thingiverse.com/thing:15113 with some code from https://www.thingiverse.com/thing:26596. It has since grown far beyond those roots. Above are just a few examples of the myriad types of containers it can generate.
In short this is a container generator that you can customize with over 50 parameters to generate all sorts of containers with lids, compartments, and mesh sides as you see fit. I am still actively developing it as I see new uses and can incorporate requests if you can describe what your looking for. You can also just print a simple box as well.
With the new version there is clear documentation and a template file that I strongly recommend you use and edit instead of editing the variables in the box generator directly.
Note that there are many parameters and variations. I have tested most options but there are innumerable configurations and its totally possible to generate boxes that aren't printable.
- Single Box.
- Repeating Box with compartments in X and/or Y direction.
- Cylinder box or box with curved bottom area to hold bits. (Partial)
- You can also combine boxes to generate more complex containers with multiple sizes of compartments and depths that fill flush to lid. (This is done with calls to
make_internal_box but requires some OpenSCAD knowledge.)
- Standard slid on top.
- Slide in form side.
- Hinged Lid.
- Snap on top. (Uses a few inner snap to make a pressure hold.
- Stackable boxes. Bottom of one box slides into top of another.
- Empty, optional rounded corners. (Use and mesh with a high strut_gap.)
- Single Direction
- Cross Hatch (Two sets Rotated by 90 degrees.)
- Spines pivoted around the vertical. (Ie to do 80 and 100 degree spines.)
- Diagonal across opening. (Calculate angle automatically cover to corner.)
- None, large opening in wall, will need supports.
- Curved for circular bits.
- Angles for hexagon tiles.
- Uneven bottom so bits don't lay flat and can more easily be grabbed. (Partial, Not Tested)
- Custom. (You can add make_wall calls in the main code to add custom walls anywhere you need.)
- Text can be applied to the sides, top, and bottom.
- Text can be raised or inset and the font and size can be adjusted.
- With multiple compartments the text can be changed for each.
- Due to language limitations the the text won't work well on walls with a mesh and there is no way to wrap two lines of text.
- Depending on the overhang, you most likely won't need supports. If you do a cutaway on a vertical wall all the way through the wall you will need supports.
- Repeat compartments.
- Snaps so boxes stay closed.
- Openings in sides to shave materials.
- Thumb gripes to ease opening.
- Openings in compartments for dropping bits in.
- Support for easily surpassing individual walls from the generated structure for larger compartments.
- Rounding on box edges.
- More complex box generation with multimedia sizes of compartments.
- Board Game Inserts.
- More Internal structure options. (Partial)
- Configurable Thumb holes for extracting cards and bits easily.
- Circular containers and rounded corners. (Partial)
- Support for custom wall mesh via custom module.
Depending on the gaps in the windows it looks like I can get ~10-30% less material used while retaining integrity but prints may take longer.
To create custom boxes download both files to the same location and then copy the
Box Template.scad file to make your working file. Edit this file as needed updating variables and adding code to create custom structure. When you are satisfied with the box save, and use the Render and then Export as STL toolbar buttons to make the solid.
Doing it this way then in the future you can simply replace the
Ultimate_Box_Generator.scad file and re-run your custom file to receive new options and fixes without having to edit anything you have customized.
// General Settings
comp_size_deep = 12; // Depth of compartments
comp_size_x = 50; // Size of compartments, X
comp_size_y = 35; // Size of compartments, Y
wall = 2.5; // Width of wall, see
internal_wall below for alternate inner wall size.
repeat_x = 1; // Number of compartments, X
repeat_y = 1; // Number of compartments, Y
tolerance=.15; // Tolerance around lid. If it's too tight, increase this. If it's too loose, decrease it.
box_corner_radius=0; // Add a rounding affect to the corners of the box. Anything over
wall will cause structure and lid problems.
internal_corner_radius=0; // Add a rounding affect to the inside. Anything over
wall will cause issues.
// Supress individual walls.
supress_walls_x=; // These are the walls running along the X axis. It should be an array of size [repeat_y-1][repeat_x].
supress_walls_y=; // These are the walls running along the Y axis. It should be an array of size [repeat_x-1][repeat_y].
// Example for repeat_x=4, repeat_y=3:
// Parts to render
show_box=true; // Whether or not to render the box
show_lid=true; // Whether or not to render the lid. To make open boxes with no lid set
// Mesh Settings
// To make rounded corners and no mesh use any
mesh_type > 0 and set
strut_gap to a high value.
// 0: No mesh, solid wall.
// 1: Single direction mesh.
// 2: Two direction cross mesh and 90 degree angle to eachother.
// 3: Two direction mesh but mirrored around 90 axsis instead or rotated 90 degrees.
// 4: Calculate angle across the diagonal of each opening. You will also want to change
strut_gap to a large number and set
// 5: No mesh, empty wall.
mesh_type=0; // Mesh type, see above.
mesh_rotation=0; // 0-90 degrees.
mesh_corner_radius=0; // Leave a radius around each corner of the mesh. May hep with bridges.
mesh_alt_rotation=mesh_rotation; // Alternate rotation for top and bottom faces.
mesh_do_sides_x=true; // Include mesh on each side along the X axis.
mesh_do_sides_y=true; // Include mesh on each side along the Y axis.
mesh_do_bottom=false; // Include mesh on bottom plate.
mesh_do_top=true; // Include mesh on top piece.
mesh_do_interior=false; // Include mesh on inner walls.
mesh_inset_padding=wall; // Leave some solid material before building strut frame. Anything less then wall will likely fall apart.
strut_width=wall*2; // Width of each strut, 0=hollow.
strut_gap=wall; // Width of the air gap between each strut. 0=fine air gaps.
strut_count_min=0; // Optinal minimum number of struts regardless of size calulations.
alt_strut_width=strut_width; // Width of struts going the other directions.
alt_strut_gap=strut_gap; // Width of gap going the other direction.
alt_strut_count_min=strut_count_min; // Optinal minimum number of struts regardless of size calulations.
// Lid Settings
// 0: Flat lid sits on top with a border.
// 1: Lid that slides off in the x direction.
// 2: Lid with a snapped in hinge that rotates open
// 3: Lid that snaps down onto the box. Also need to change lid_height to around 1.5mm.
// 4: Stackable version of cover 1 there boxes slide into one another. You will need one cover for the last box. (Not tested)
lid_type=1; // Lid type, see above.
has_thumbhole=true; // Add gripping locations for easy opening.
has_coinslot=false; // Add slot in the top for dropping in components.
has_snap=true; // Add small ridges or snaps to lids to help keep them closed.
coinslot_x=20; // Size in X direction
coinslot_y=2.5; // Size in Y direction
z_tolerance=0; // Z tolerance can be tweaked separately, to make the top of the sliding lid be flush with the top of the box itself.
extra_bottom=.15; // Extra bottm wall height to fit type 4 slider.
hinge_inset=.75; // Size of the hinge connection.
snap_inset=.25; // Amount of overhang for snaps to snap into place.
snap_tolerance=tolerance; // You may need to add tolerance around lid and snaps to let them move freely.
lid_offset=3; // This is how far away from the box to print the lid
lid_height=wall*2; // Height of lid. Must be greater than wall width for a
lid_type=0 lid to work. On Lid 3 is the depth of the inset snap.
//Internal Structure (You may need to turn off
mesh_do_bottom for good results.)
// You can also use
make_wall() to menaully add your own walls.
// 1: Rounded bottom frame.
// 2: Hexegon bottom frame. (To make this shape perfect set
comp_size_deep to the width between to edges of the tile and set
comp_size_y to this this:
comp_size_deep / sqrt(3)*2.
// 3: Rough bottom for make bits sit unevenly.
internal_type=0; // Internal structure, see above.
internal_rotate=false; // On lid axis or rotate to opposite.
internal_size_deep=comp_size_deep/2; // How far into the box to start the internal structure. Should be
comp_size_deep/2 for type 1 and 2 or around
wall for 3.
internal_wall=wall; // Custom size for internal walls.
// Text Settings. (Note that this may not work well on a mesh and there is no easy way to calculate the text size to exclude it from meshing.)
// Text rendering type
// 0: None.
// 1: Cutout.
// 2: Raised. (Won't print well on
lid_type 0 and 3.)
text_type=0; // Text type, see above.
text_depth=wall/6; // Distance to cutout text or raise it. User
wall to cut through.
text_size=5; // Font Size.
text_font="Courier New:style=Bold"; // Use Hepl -> Font List to see options.
text_message="Red Player"; // Message Text
text_message_compartments=false;//[["AA", "BB", "CC"], ["AB", "BC", "CD"]]; // Custom text for compartments in top or bottom.
text_sides=true;//[true, true, true, false]; // Sides to put text on, [X, Y, X, Y]
text_top=true; // Put Text on the top.
text_bottom=false; // Put Text on the bottom.
text_rotation=0; // Rotate the top and bottom text by X degrees. 90 will rotate from the X axis to the Y axis.
text_offset=0; // Text is verticaly centered in the wall. This may look "off" due to casing or hanging tails. You can manually adjust the vertical alignment with this setting.
// Complex Structure
9/24/2018 - Fix for Hinged cover snap.
9/24/2018 - Added support for including a line of text on the sides, top, or bottom. The bottom text can be read from looking into the box. Text can be raised or cut into the wall. Top and bottom text can be specified for each compartment.
9/24/2018 - Added a template for creating boxes and definition in a separate file to updates to the generator can be easily loaded into a project.
9/24/2018 - Fix for solid covers on on boxes with repeating compartments.
9/24/2018 - Fix for internal structure not extending as expected if there were suppressed walls causing voids.
9/24/2018 - Fix for internal structure rendering in places it shouldn't where there was a suppressed wall.
9/24/2018 - Added a option for including rounded corners on the boxes.
11/07/2017 - Simplified internal math with functions and pre-calculations. Added Stackable boxes. Added function to add custom walls. Improved mesh performance. Added support for generating multimedia boxes of different sizes in one program by passing override parameters to the functions. Renamed project and updated documentation.
11/07/2017 - Added two arrays that can be used to suppress internal walls and make larger compartments or compartments of varying sizes.
10/27/2017 - Added some basic options for adding extra internal structures to a compartment. You can adjust in the
make_box_internal function. Other fixes for the file uploaded yesterday.
10/26/2017 - Added Mesh type 4 that calculates the angle along the hypotenuse for spines. Also added slight snaps for the slide in lid.
10/24/2017 - Added Mesh type 3, this pivoted around the vertical axis instead of rotating 90 degrees. Can be useful for creating steeper or shallower angles which may be easier to print. Added a lid types 2 and 3. 2 will snap into the box with a small inset lip. 3 will create a roller at one end and flip open and closed.
10/23/2017 - Major update and rewrite, removed large chunks or repeated code and moved logic into modules. Better documentation and parameters, fixes for mesh calculation issues, new modes.
10/20/2017 - Updated with fixes for lid 0 and some mesh layout errors.