A 3D Model Slicing and SVG Generation Application
- Ensure Python 3.12 or newer is installed.
- Install the GEOS library (required by
shapely
). - Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate
- Install LayerForge and its dependencies:
Alternatively, run
pip install -e .
pip install -r requirements.txt
if you only need the runtime dependencies. To ensure all optional features are available use:pip install -e .[full]
- Install development dependencies for running the tests:
pip install -r requirements-dev.txt
The following Python packages are required at runtime:
trimesh
– mesh loading and manipulationsvgwrite
– generating SVG filesshapely
– geometric computations
These packages are installed automatically when installing LayerForge.
Run the CLI to slice an STL model and produce SVGs:
layerforge --stl-file model.stl --layer-height 3.0 --output-folder output
Optional flags let you scale the model and control marker placement. Use layerforge --help
for all options.
Use Python to display the installed package version:
python -c "import layerforge; print(layerforge.__version__)"
- Slice STL models into individual layers.
- Generate SVG files with contours, slice numbers and reference marks.
- Reference marks are chosen using a geometric stability metric inspired by GDOP.
- Marks inherit shape, position, angle and color between adjacent slices and are adjusted to avoid overlaps.
- Supports multiple mark shapes (circle, square, triangle, arrow) for easy identification.
- Pyoxidizer packaging enables simple cross-platform distribution.
The CLI exposes parameters for tuning reference mark generation:
--mark-tolerance
– distance used when matching an existing mark. Defaults to10.0
.--mark-min-distance
– minimum distance from contours and between marks. Defaults to10.0
.--available-shapes
– comma separated list of shapes to cycle through when creating marks. Defaults tocircle,square,triangle,arrow
.--mark-angle
– default orientation angle for generated marks in degrees.--mark-color
– outline color for reference marks.
See docs/reference_mark_algorithm.md#parameter-effects for diagrams and tuning tips on how these options influence mark placement.
Contributions are welcome! Please read our Code of Conduct before participating in this project.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) License for non-commercial use. For commercial use, please contact Caitlyn O'Hanna at caitlyn.ohanna@gmail.com to obtain a commercial license.
For more details, see the LICENSE file for non-commercial use and the COMMERCIAL_LICENSE file for commercial use.
For questions, comments, or concerns, please contact Caitlyn O'Hanna at caitlyn.ohanna@gmail.com. Citation information is available in CITATION.cff.
LayerForge by Caitlyn O'Hanna is licensed under CC BY-NC 4.0