Created combine_svg_vertical.py to vertically stack SVG files with centering
and configurable spacing. Enhanced svg_logo_to_stl.py with plate dimensions
and margin options for better nameplate creation.
combine_svg_vertical.py features:
- Vertically combines two SVG files (icon above text)
- Automatically centers smaller element
- Configurable spacing between elements (default: 20px)
- Configurable margin around composition (default: 10px)
- Preserves individual SVG structure in groups
svg_logo_to_stl.py enhancements:
- Added --plate-width and --plate-height options
- Logo scales to fit within plate dimensions (maintaining aspect ratio)
- Added --margin option for spacing around logo on plate
- Automatic centering of logo on plate
- Reports actual dimensions: plate, logo, margin, and offset
Example usage:
# Combine icon and text
python combine_svg_vertical.py um_grey.svg um_black.svg combined.svg --spacing 114
# Center on 256x256mm plate with 10mm margin
python svg_logo_to_stl.py combined.svg output \
--plate-width 256 --plate-height 256 --margin 10 \
--base-thickness 1.5 --feature-height 2.5
Files:
- combine_svg_vertical.py: Vertical SVG stacking tool
- README_combine_svg.md: Documentation for combine tool
- underground-magnetics-combined.svg: Example combined logo
- svg_logo_to_stl.py: Enhanced with plate dimensions
- command.txt: Updated with new parameters
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
47 lines
2.3 KiB
Plaintext
47 lines
2.3 KiB
Plaintext
# SVG to Multi-Color 3D Model Converter
|
|
# Automatically detects all colors in SVG and creates one part per color
|
|
# Note: The DYLD_LIBRARY_PATH is needed for Cairo to work on macOS
|
|
|
|
# Basic usage - specify width, logo scales proportionally
|
|
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH" && source .venv/bin/activate && python svg_logo_to_stl.py "Color logo - no background.svg" logo_output --width-mm 254 --base-thickness 1.5 --feature-height 2.5
|
|
|
|
# Plate dimensions - logo scales and centers on specified plate size with margin
|
|
python svg_logo_to_stl.py underground-magnetics-combined.svg um_logo --plate-width 256 --plate-height 256 --margin 10 --base-thickness 1.5 --feature-height 2.5
|
|
|
|
# Or if you've already activated the venv and set the library path:
|
|
python svg_logo_to_stl.py "Color logo - no background.svg" logo_output --width-mm 254 --base-thickness 1.5 --feature-height 2.5
|
|
|
|
# Works with ANY SVG file! The script will:
|
|
# 1. Automatically detect all unique colors
|
|
# 2. Create one part per color
|
|
# 3. Generate assembly with separate selectable parts
|
|
|
|
# Output files:
|
|
# - logo_output_base.stl - Black base plate
|
|
# - logo_output_{color}.stl - One STL per detected color
|
|
# - logo_output_assembled.stl - All parts combined (single mesh)
|
|
# - logo_output_assembled.3mf - All parts as single mesh (for paint tool)
|
|
# - logo_output_parts.3mf - Separate selectable parts (BEST for multi-color!)
|
|
|
|
# Import logo_output_parts.3mf into BambuStudio
|
|
# Each detected color becomes a separate selectable part
|
|
# Assign different filaments to each part for multi-color printing
|
|
|
|
# Example for this logo:
|
|
# 1. base - black base plate
|
|
# 2. white - "SPARKSOFT DESIGN" text
|
|
# 3. green - microchip icon + "EMBEDDED SOLUTIONS" text
|
|
|
|
# Total model height: base_thickness + feature_height (default: 0.8mm + 1.8mm = 2.6mm)
|
|
|
|
# IMPORTANT: Scale must be 254mm or larger for 0.4mm nozzle
|
|
# Smaller sizes cause features to be too small for proper toolpath generation
|
|
|
|
# Parameters:
|
|
# --width-mm: Logo width in mm (if plate dimensions not specified)
|
|
# --plate-width: Plate width in mm (logo will be scaled and centered)
|
|
# --plate-height: Plate height in mm (logo will be scaled and centered)
|
|
# --margin: Margin around logo when using plate dimensions (default: 0)
|
|
# --base-thickness: Base plate thickness in mm (default: 0.8)
|
|
# --feature-height: Raised feature height in mm (default: 1.8)
|