Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Support Structure Minimization

Automatically find the optimal 3D print orientation that minimizes support material — saving filament, reducing print time, and improving surface quality.

Support Structure Minimizer GUI


The Problem

Popular slicers like Bambu Studio generate support structures for overhanging geometry, but they do not search for the optimal print orientation that minimizes the amount of support material needed. The model is simply printed in whatever orientation it was imported in — leaving users to manually rotate their models and guess at the best angle, often wasting filament on unnecessary supports.

We initially attempted to integrate this optimization feature directly into Slic3r, the popular open-source slicer. However, the Slic3r codebase proved extremely difficult to extend — its architecture made adding a new optimization pass impractical. We decided to build a standalone tool modeled after the original program, with its own UI designed to replicate the familiar slicer workflow while giving us full control over the optimization pipeline.

How It Works

  1. Overhang Detection — Triangles whose face normals exceed a configurable overhang threshold are identified as requiring support.

  2. Loss Functions — Two loss functions quantify the cost of support material for a given orientation:

    • Naive — Sums the distance from each overhanging triangle to the build plate, weighted by face area. Fast but ignores internal geometry.
    • Hole-Aware — Casts rays upward from the build plate and uses inside/outside logic to skip distances that fall within the solid body of the model. More accurate for meshes with holes or internal cavities.
  3. Orientation Optimization — Searches over Euler angles (rx, ry, rz) to minimize the chosen loss:

    Optimizer Strategy
    de Differential Evolution (SciPy) — robust global search
    bayes Bayesian Optimization (scikit-optimize) — sample-efficient GP surrogate
    cma CMA-ES — covariance matrix adaptation
    ctf Coarse-to-Fine — grid search → CMA-ES refinement
  4. Mesh Decimation — Optionally simplify the mesh via quadric decimation during the search to speed up evaluation, then apply the best rotation to the original full-resolution mesh.

Quick Start

git clone https://github.com/<your-username>/SupportStructureMinimization.git
cd SupportStructureMinimization

python -m venv env && source env/bin/activate   # Windows: env\Scripts\activate
pip install -r requirements.txt

GUI

python src/ui.py

Browse for an input mesh, configure optimization parameters, run the optimizer, and export — all from the GUI.

CLI

# Optimize orientation and export
python src/main.py models/3DBenchy.stl output.obj --optimize

# Bayesian optimizer with hole-aware loss
python src/main.py models/teapot.obj output.obj --optimize --optimizer bayes --loss hole

# Decimate for faster search on large meshes
python src/main.py models/cat.obj output.obj --optimize --decimate --sim-faces 1000

# Visualize result with ground plane
python src/main.py models/3DBenchy.stl output.obj --optimize --visualize

# Custom overhang threshold
python src/main.py models/3DBenchy.stl output.obj --optimize --overhang 20

CLI Reference

Argument Description Default
mesh Input mesh file (.obj / .stl) required
output Output path for the optimized mesh required
--optimize Enable orientation optimization off
--optimizer de · bayes · cma · ctf de
--loss naive · hole naive
--overhang Overhang threshold (degrees) 15
--decimate Simplify mesh during search off
--sim-faces Target face count for decimation 0
--sim-aggression Decimation aggression level 4
--visualize Open 3D viewer with ground plane off

Project Structure

├── src/
│   ├── main.py              # Entry point & optimization pipeline
│   ├── loss.py              # Naive and hole-aware loss functions
│   ├── optimizer.py         # DE, Bayesian, CMA-ES, coarse-to-fine
│   ├── ui.py                # Tkinter GUI
│   ├── convdef.py           # Convexity deficit utility
│   ├── dimpled_spheres.py   # Parameterized test mesh generator
│   ├── generate_meshes.sh   # Batch mesh generation
│   └── torus_knot.scad      # OpenSCAD torus-knot models
├── scripts/                 # Data collection & charting
├── models/                  # Sample meshes (Benchy, teapot, cat, etc.)
├── data/                    # Experiment results
└── requirements.txt

Dependencies

Package Purpose
trimesh[easy] Mesh loading, manipulation, ray casting
fast-simplification Quadric mesh decimation
scikit-optimize Bayesian optimization (Gaussian Process)
cma CMA-ES optimizer
matplotlib Result visualization

Contributors

Name
🔧 Ryan Crosier
🔧 Oguz Elgin
🔧 Andrew Cho

License

This project is released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages