Skip to content

Generic Tray Creator Script (with rounded bin floors)

Advertising
Advertising
?
Creation quality: 5.0/5 (1 vote)
Evaluation of members on the printability, utility, level of detail, etc.

  • 863 views
  • 1 like
  • 22 downloads

License
3D design format
Folder details Close
  • README.txt
  • tray_40x60x35x20_by_30x40.scad.stl
  • tray_45x65x80_by_40x40x60.scad.stl
  • tray_5x1_noround.scad.stl

Learn more about the formats

Publication date 2022-10-14 at 16:54
?
Published to Thingiverse on: 2014-09-07 at 21:46
Design number 885508

3D printer file info

3D model description

This is not about a specific model, it's about my python/SolidPython script that creates arbitrary grid trays (with rounded bottoms so there's no corners), useful for organizing lots of small items. Especially nice for creating board game organizers.

The script is attached, it is called "generic_tray.py". You run it from the command line with the grid dimensions and it will spit out a .scad file and [optionally] a .stl file. It will also show you the [approximate] volume of each bin.

USAGE

ALL UNITS ARE MILLIMETERS

The tray will be specified by the dimensions of each row/column,

provided as two arrays. The example screenshot shows the terminal after running the tool. Use the following command-line call to create the example in the screenshot (x-axis always first).

python generic_tray.py [40,60,35,20] [30,40]

Make sure there are no spaces before or after the commas in the lists: You can add extra args to adjust floor- and wall-thickness, bin depth and how rounded you want the bins to be on the bottom:

python generic_tray.py [40,60,35,20] [30,40] --depth=55 --outfile=mytray.scad

Type the following to see all options:

python generic_tray.py --help

*** IF YOU DON'T WANT/CAN'T DO THE COMMAND-LINE THING, then follow the directions towards where CLI_OPTIONS and CLI_ARGS are set in the script. You can remove all the CLI_* code and simply hardcode the tray size into this script so you only have to double-click it to generate the SCAD file. This will automatically generate a .scad file that can be loaded into OpenSCAD. It will always ask if you want to also generate the .stl file, which can be loaded into most 3D printing slicers, but this can be very slow unless you are using --round=0.

It is recommended, if you are tweaking the tray dimensions and checking resultant bin volumes, to always skip creating the STL (type nothing, press enter), until you are happy with it, then re-run the last command and type "y" before enter to generate the .stl.

NOTE: Read the README.txt, and note that if you need precise bin sizes, calibrate your printer using my calibration cubes and create a caldata.py file: http://www.thingiverse.com/thing:230596

SETUP

The requirements to use generic_tray.py is:

Python 2.X

OpenSCAD

SolidPython (python wrapper around OpenSCAD)

(1) You must install the latest Python 2.X, currently python 2.7.8 if you are in Windows (comes installed by default in Linux & OSX). DO NOT install python 3.X -- this only works with python2.X:

https://www.python.org/downloads/

(2) You need to have OpenSCAD installed. The script always generates a .scad file, which requires OpenSCAD for viewing and/or converting to STL format. In Ubuntu, install openscad through the pkg manager:

sudo apt-get install openscad

Otherwise, download it from here:

http://www.openscad.org/downloads.html

Even if you don't use the OpenSCAD application, you must have OpenSCAD available so that the script can use it to generate the STL files. The script assumes that "openscad" program/exe is in your PATH. If it isn't, you may need to adjust the generic_tray.py script to call the full path to openscad or openscad.exe.

(3) SolidPython is required for the generic_tray.py script to be able to generate .scad files. Generally speaking, you can use OpenSCAD by itself to make 3D models, but the SCAD "language" is weak and extremely limited in functionality. SolidPython is a python library that lets you create your models in python (using proper variables, loops, etc), and it generates simple SCAD for you.

Get SolidPython from here:

https://github.com/SolidCode/SolidPython

You can simply copy the "solid" directory into your project directory (so that the generic_tray.py script can call "import solid" and it will find ./solid/init.py). Or within the outer SolidPython directory, you can run sudo python setup.py install. This will install the "solid" directory into your global site-packages directory so that it will be available no matter where you run generic_tray.py.

3D printing settings


USAGE

ALL UNITS ARE MILLIMETERS

The tray will be specified by the dimensions of each row/column,

provided as two arrays. If your tray is going to look like this:

----------------------------------

| | | |

60mm | | | |

----------------------------------

| | | |

60mm | | | |

----------------------------------

| | | |

| | | |

100mm | | | |

----------------------------------

30mm | | | |

----------------------------------

40mm 25mm 70mm

Use the following command-line call to create the above (x-axis always first).

Make sure there are no spaces before or after the commas in the lists:

python generic_tray.py [40,25,70] [30,100,60,60]

You can add extra args to adjust floor- and wall-thickness, bin depth

and how rounded you want the bins to be on the bottom:

python generic_tray.py [40,25,70] [30,100] --depth=55 --outfile=mytray.scad

Type the following to see all options:

python generic_tray.py --help

IF YOU DON'T WANT/CAN'T DO THE COMMAND-LINE THING, then follow the

directions towards where CLI_OPTIONS and CLI_ARGS are set in the script.

You can remove all the CLI_* code and simply hardcode the tray size into

this script so you only have to double-click it to generate the SCAD file.

This script automatically generates a .scad file that can be loaded into

OpenSCAD. It will always ask if you want to also generate the .stl file,

which can be loaded into most 3D printing slicers, but this can be very

slow unless you are using --round=0 (rdepth var in the script).

If you have OpenSCAD open with the model loaded, make sure you check the

option: "Design"->"Automatic Reload and Compile". This makes sure that

the GUI will refresh itself as soon as you re-run the script, as long as

the output is the same name (use --outfile arg to avoid having the filename

change when you change the dimensions). In my experience, OpenSCAD will

usually reload it, but sometimes you have to hit F6 to do a full render

for it to show up.

It is recommended, if you are tweaking the tray dimensions and checking

resultant bin volumes, to always skip creating the STL (type nothing, press

enter), until you are happy with it, then re-run the last command and type

"y" at the prompt to generate the .stl.

Alternatively, if you want to create the .stl file in the OpenSCAD app, you

must do a full render by hitting F6, then use "Design"->"Export as STL...".

If the model is loaded, it

SETUP

The requirements to use generic_tray.py is:

Python 2.X

OpenSCAD

SolidPython (python wrapper around OpenSCAD)

(1) You must install the latest Python 2.X, currently python 2.7.8

if you are in Windows (comes installed by default in Linux & OSX)

DO NOT install python 3.X -- this only works with python2.X:

https://www.python.org/downloads/

(2) You need to have OpenSCAD installed. The script always generates

a .scad file, which requires OpenSCAD for viewing and/or converting

to STL format. In Ubuntu, install openscad through the pkg manager:

sudo apt-get install openscad

Otherwise, download it from here:

http://www.openscad.org/downloads.html

Even if you don't use the OpenSCAD application, you must have OpenSCAD

available so that the script can use it to generate the STL files.

The script assumes that "openscad" program/exe is in your PATH. If

it isn't, you may need to adjust the generic_tray.py script to call the

full path to openscad or openscad.exe.

(3) SolidPython is required for the generic_tray.py script to be able to

generate .scad files. Generally speaking, you can use OpenSCAD by

itself to make 3D models, but the SCAD "language" is weak and extremely

limited in functionality. SolidPython is a python library that lets

you create your models in python (using proper variables, loops, etc),

and it generates simple SCAD for you.

Get SolidPython from here:  
    https://github.com/SolidCode/SolidPython  
You can simply copy the "solid" directory into your project directory (so  
that the generic_tray.py script can call "import solid" and it will find  
./solid/__init__.py).  Or within the outer SolidPython directory, you can   
run "sudo python setup.py install".  This will install the "solid" directory  
into your global site-packages directory so that it will be available no   
matter where you run generic_tray.py.
Advertising


Issue with this design? Report a problem.

Would you like to support Cults?

You like Cults and you want to help us continue the adventure independently? Please note that we are a small team of 3 people, therefore it is very simple to support us to maintain the activity and create future developments. Here are 4 solutions accessible to all:

  • ADVERTISING: Disable your banner blocker (AdBlock, …) and click on our banner ads.

  • AFFILIATION: Make your purchases online by clicking on our affiliate links here Amazon.

  • DONATE: If you want, you can make a donation via Ko-Fi πŸ’œ.

  • WORD OF MOUTH: Invite your friends to come, discover the platform and the magnificent 3D files shared by the community!


Sharing and downloading on Cults3D guarantees that designs remain in makers community hands! And not in the hands of the 3D printing or software giants who own the competing platforms and exploit the designs for their own commercial interests.

Cults3D is an independent, self-financed site that is not accountable to any investor or brand. Almost all of the site's revenues are paid back to the platform's makers. The content published on the site serves only the interests of its authors and not those of 3D printer brands who also wish to control the 3D modeling market.

100% secure payment by credit card, PayPal, Apple Pay, Google Pay, etc.
View all payment options.