https://github.com/S1N4X/SmithForge
A tool for combining two 3MF models by overlaying a Hueforge model onto a base model with automatic scaling, positioning, and proper model intersection.
https://github.com/S1N4X/SmithForge
3d 3d-models 3d-printing 3mf chromalink decor hueforge mesh model stl
Last synced: over 1 year ago
JSON representation
A tool for combining two 3MF models by overlaying a Hueforge model onto a base model with automatic scaling, positioning, and proper model intersection.
- Host: GitHub
- URL: https://github.com/S1N4X/SmithForge
- Owner: S1N4X
- License: gpl-3.0
- Created: 2024-12-26T22:47:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-27T05:15:40.000Z (over 1 year ago)
- Last Synced: 2024-12-27T05:20:57.241Z (over 1 year ago)
- Topics: 3d, 3d-models, 3d-printing, 3mf, chromalink, decor, hueforge, mesh, model, stl
- Language: Python
- Homepage:
- Size: 730 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README

# SmithForge
SmithForge is a tool for seamlessly combining two 3MF models by overlaying and embedding a Hueforge model onto a base shape with automatic scaling, positioning, and precise intersection alignment. All this using the great [trimesh](https://github.com/mikedh/trimesh) Python library. The resulting 3MF file would then be ready to be opened in your favourite slicer for 3D printing.
This small but efficient script can be used to automate the process of shaping HueForge models to your needs. HueForge Z axis integrity is kept through the process (which means the script does not modify the original Z height config).
This project was originally designed to simplify embedding Hueforge models onto ChromaLink (previously named MagHex) hexagonal bases. Please see the [Slug3D.com](https://www.slug3d.com) ChromaLink's framework for 3D printed wall art designing.
[](https://www.gnu.org/licenses/gpl-3.0)
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
## Features
- Automatic scaling of X & Y axis to match the base dimensions while maintaining aspect ratio.
- The Z-axis scaling remains unchanged throughout the process to avoid disrupting the Hueforge's visual integrity
- Also maintains model integrity through convex hull clipping
- Automatic centering
- Custom X/Y/Z positioning
- Proper model intersection and union
- Smart Z-axis embedding with configurable overlap
- Base model rotation support
## Technical Process
1. Loads both 3MF models
2. Optionally rotates base model
3. Calculates and applies scaling to match base dimensions
4. Centers Hueforge on base model
5. Embeds Hueforge with slight Z overlap
6. Applies user-specified position adjustments
7. Creates convex hull of base for proper intersection
8. Performs boolean operations for clean combination
9. Exports final unified model
## Notes
- Default overlap is 0.1mm for proper model union (can be changed with --zshift)
- Scale maintains aspect ratio in X/Y dimensions
- Z-axis height is never modified (as per HueForge guidelines)
- Models must have proper manifold geometry
## Future Features
- Add height modifiers and filament colours from HueForge description files in the 3MF output
## Requirements
- Python 3.x
- trimesh
- shapely
- A base model (.3mf)
- A model to be embedded like a HueForge (.3mf)
## Installation
```bash
pip install trimesh shapely
```
## Usage
```bash
python smithforge.py -f hueforge.3mf -b base.3mf [options]
```
### Parameters
#### File paths
```bash
-f, --hueforge: Path of the 3MF file that will serve as the overlay to be embedded to the base (required)
-b, --base: Path of the base shape 3MF file (required)
-o, --output: Output file path (default: combined.3mf)
```
#### Overlay geometry
```bash
--xshift: X-axis shift in mm
--yshift: Y-axis shift in mm
--zshift: Z-axis shift in mm
-s, --scale: Force specific scale value
--scaledown: Allow downscaling below 1.0
```
#### Base geometry
```bash
--rotatebase: Rotate base model (degrees, 0-360)
```
### Examples
Basic combination:
```bash
python smithforge.py -f hueforge.3mf -b base.3mf
```
Rotate base and adjust position of HueForge (in mm):
```bash
python smithforge.py -f hueforge.3mf -b base.3mf --rotatebase 90 --xshift 5 --zshift 0.5
```
Force a user defined scale for the HueForge model (example: 1.5x size)
```bash
python smithforge.py -f hueforge.3mf -b base.3mf -s 1.5
```