Skip to content

seedback/LayerSafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LayerSafe - Parametric 3D Tray Generator

A Python-based parametric tray generator for the LayerSafe project—a modular storage system created by Newman (electrumbeaulo) on Discord.

This tool generates customizable 3D storage trays with hinged flaps using the build123d CAD library.

Features

LayerSafe generates parametric 3D tray designs featuring:

  • Adjustable dimensions (width and depth)
  • Hinged flap mechanisms for opening/closing
  • Customizable rails and base structure
  • Built-in cutouts for organization
  • Support for single or double tray configurations
  • Export capabilities in STEP and STL formats

Requirements

  • Python 3.8+
  • build123d - CAD library for 3D modeling
  • OCP VSCode - VS Code integration for viewing 3D models

Installation

  1. Clone the repository:

    git clone https://github.com/seedback/LayerSafe
    cd LayerSafe
  2. Install dependencies:

    pip install build123d ocp-vscode
  3. Verify installation:

    python -c "import build123d; print('build123d installed successfully')"

Usage

Command-Line Interface

The tray generator is designed to be run from the command line, making it easy for anyone to use without setting up an IDE.

Basic Syntax

python Trays/tray_generator.py <diameter1> <diameter2> ... [options]

⚠️ Important: Base diameters should be measured as accurately as possible. Precision down to 0.1mm is recommended for proper fit. Use quality calipers with good accuracy (±0.1mm or better) to measure your bases before generating the tray.

Simple Examples

Generate a tray with 6 circles of 31.6mm diameter:

python Trays/tray_generator.py 31.6 31.6 31.6 31.6 31.6 31.6

Generate a tray with mixed diameters (2× 25.4mm and 1× 31.6mm):

python Trays/tray_generator.py 25.4 25.4 31.6

Available Options

Option Type Default Description
--width float 189.5 Total tray width in mm
--depth float 66.0 Total tray depth in mm
--safety-margin-x float 6.5 Horizontal margin from edges (mm)
--safety-margin-y float 0.8 Vertical margin from edges (mm)
--tolerance float 0.55 Tolerance for circle fit (mm)
--edge-offsets space-separated floats None Edge offsets for each base (e.g., 0.5 0.5 0.5) will reduce the depth of the base with the given amount without affecting the width. Useful for fine-tuning fit, especially on larger bases (mm)
--edge-adjusts space-separated floats None Edge adjustments for each base (e.g., 0.2 0.2 0.2), independent of edge-offsets for additional fine-tuning, a larger value will give a larger flat-spot below the curved section (mm)
--single-sided flag False Generate a single-sided tray (default: double-sided)
--force-linear-positions flag False Forces linear positioning (default: automatically selects linear or alternating positioning)
--output string auto Output filename (without extension)

Advanced Examples

Adjust safety margins for a tight fit:

python Trays/tray_generator.py 31.6 31.6 31.6 31.6 31.6 31.6 --safety-margin-y 0.4

Custom dimensions with tolerance adjustment:

python Trays/tray_generator.py 25.4 25.4 25.4 --width 200 --depth 80 --tolerance 0.6

Generate a single-sided tray (not double-sided):

python Trays/tray_generator.py 31.6 31.6 31.6 --single-sided

Apply edge offsets to customize base positioning:

python Trays/tray_generator.py 25.4 25.4 25.4 --edge-offsets 0.5 0.5 0.5

Apply edge adjustments for additional fine-tuning:

python Trays/tray_generator.py 25.4 25.4 25.4 --edge-adjusts 0.2 0.2 0.2

Specify a custom output filename:

python Trays/tray_generator.py 31.6 31.6 31.6 --output my_custom_tray

Combine multiple options:

python Trays/tray_generator.py 31.6 31.6 31.6 31.6 31.6 31.6 --safety-margin-y 0.4 --tolerance 0.6 --width 190 --single-sided --edge-offsets 0.2 0.2 0.2 0.2 0.2 0.2 --edge-adjusts 0.1 0.1 0.1 0.1 0.1 0.1 --output special_tray

Getting Help

View all available options:

python Trays/tray_generator.py --help

Output

Generated files are automatically saved to Trays/output/:

  • STL format (.stl) — Suitable for 3D printing
  • STEP format (.step) — Suitable for CAD software and CNC machines

Filenames are auto-generated based on your diameter input (e.g., tray_6x31.6mm.stl), or you can specify a custom name with --output.

Jupyter Notebook (Optional)

If you prefer an interactive notebook environment:

  1. Open Trays/tray_generator.ipynb in Jupyter
  2. Modify the default parameters in the notebook and run cells
  3. View the 3D model preview in the notebook output

Python IDE Usage (Optional)

To use in VS Code or another IDE:

  1. Open Trays/tray_generator.py
  2. Modify the default parameters in the "User-Adjustable Parameters" section
  3. Run the script (VS Code: F5 or Run button)

Customizing Tray Parameters

For more detailed customization, you can edit the User-Adjustable Parameters section in tray_generator.py:

total_width = 189.5        # Overall tray width (mm)
total_depth = 66.0         # Overall tray depth (mm)
floor_thickness = 0.4      # Bottom thickness (mm)
base_height = 4.2          # Height of base section (mm)
rail_height = 8.4          # Height of side rails (mm)
rail_width = 4.8           # Width of side rails (mm)
flap_depth = 11.8          # Depth of hinged flap (mm)
flap_center_gap = 0.2      # Gap between flap and base (mm)
hinge_width = 2.8          # Width of hinge mechanism (mm)
hinge_height = 3.6         # Height of hinge mechanism (mm)
is_double_tray = True      # Set to True for stacked tray configuration

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Alexander Bøhler (Seedback)

Support & Contributions

For issues or suggestions, please refer to the project repository.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages