Commit Graph

4 Commits

Author SHA1 Message Date
859ce050a3 Add SVG combination tool and plate dimension options
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>
2026-05-31 12:23:24 -05:00
2719ec244d Add PNG to SVG color separation tool for multi-color 3D printing
Created split_png_by_brightness.py to split rasterized logos into separate
SVG files by color for Underground Magnetics logo conversion.

Key features:
- OpenCV contour hierarchy detection for proper hole handling
- Letters with enclosed shapes (d, o, g, etc.) now render correctly
- Tight brightness thresholds to avoid antialiasing artifacts
- Automatic bounding box cropping for optimal file sizes
- Black text: brightness < 40 (236k pixels, 21 shape groups)
- Grey icon: brightness 108-118 (119k pixels, 2 shape groups)

Results:
- um_black.svg: 6.1KB, 3070x233px (was 139KB, 3613x391px)
- um_grey.svg: 728B, 413x390px (was 253KB, 3613x391px)

Files:
- split_png_by_brightness.py: Main color separation tool
- IMPROVEMENTS.md: Detailed changelog and comparison
- README_underground_magnetics.md: Usage documentation
- underground-magnetics.eps: Source logo file
- um_black.svg: Separated black text (cropped)
- um_grey.svg: Separated grey icon (cropped)
- requirements.txt: Added opencv-python dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-31 09:51:24 -05:00
8b80f68a19 Fix SVG to STL conversion for multi-color 3D printing
Split green features into separate non-overlapping parts to fix slicing issues.

Key changes:
- Split green mask into icon (top) and text (bottom) using white text as separator
- Create 4 separate parts: base, green_icon, white_text, green_text
- Parts positioned at same Z height but don't overlap in XY space
- Assembly structure matches nameplate.3mf (components with identity transforms)
- Fixed polygon detection: reduced min_size, added preserve_topology
- Added mesh repair logic to ensure watertight meshes
- Updated material maps for new part names

Files:
- svg_logo_to_stl.py: Main conversion script with green split logic
- Color logo - no background.svg: Source SVG file
- command.txt: Usage documentation with working parameters
- requirements.txt: Python dependencies
- .gitignore: Exclude output files and debug images

Minimum scale: 254mm width for 0.4mm nozzle (smaller features too thin to print)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-31 09:02:30 -05:00
7a38de8ef2 initial commit 2026-05-30 10:50:23 -05:00