Merge branch 'migrate-svg-nametag-format' into web-app
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,2 +1,5 @@
|
||||
.venv/
|
||||
wiki
|
||||
nametags/
|
||||
stls/
|
||||
SVGs/
|
||||
nametags.zip
|
||||
15
README.md
15
README.md
@@ -1,23 +1,24 @@
|
||||
# svg2nametag-Ren
|
||||
|
||||
<p align="center">
|
||||
<img src="webapp/public/pwa-192x192.png" alt="Logo" width="128">
|
||||
<img src="/pwa-512x512.png" alt="Logo" width="128">
|
||||
</p>
|
||||
|
||||
## Overview
|
||||
**svg2nametag-Ren** converts 2D SVG designs into 3D printable nametags. It automatically splits your design into separate files for different colors, making it easy to print multi-color nametags on printers like the Bambu Lab series.
|
||||
|
||||
For detailed setup and usage guides, please check out the **[Wiki](https://git.randomhack.com/Retro/svg2NameTag-Ren/wiki)**.
|
||||
For detailed setup and usage guides, please check out the **[Wiki](https://git.randomhack.com/Retro/svg2NameTag-Ren.git)**.
|
||||
|
||||
## Physical Dimensions
|
||||
The program automatically scales all designs to these specific measurements for a consistent, professional look:
|
||||
|
||||
- **Total Width**: 87.80 mm
|
||||
- **Background Thickness**: 3.0 mm
|
||||
- **Text/Detail Thickness**: 2.0 mm
|
||||
- **Text/Detail Offset**: 3.0 mm (Text sits at 4mm from the bottom)
|
||||
- **Total Height**: 5.0 mm (Text sits 3mm high and extends 2mm up)
|
||||
- **Background Thickness**: 3.0 mm
|
||||
- **Text/Detail Thickness**: 2.3 mm (includes 0.3mm inset compensation)
|
||||
- **Text/Detail Offset**: 2.7 mm (Text is inset into background for better adhesion)
|
||||
- **Total Height**: 5.0 mm
|
||||
|
||||
## Ways to Use
|
||||
- **Web App**: The easiest way! Just open the web page, drag your files in, and download the results. No installation required.
|
||||
- **Python Tool**: For advanced users who want to process hundreds of files at once using the command line. Requires Python 3.12 or higher and some basic knowledge of the command line.
|
||||
- **Web App**: The easiest way! Just open the web page, drag your files in, and download the results. No installation required. Note: The Web App currently does not support New Format SVGs. It can only read a direct export from Adobe Illustrator.
|
||||
- **Python Tool**: For advanced users who want to process hundreds of files at once using the command line. Requires Python 3.12 or higher and some basic knowledge of the command line. Supports New Format.
|
||||
|
||||
@@ -15,8 +15,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Constants based on specs
|
||||
BACKGROUND_THICKNESS = 3.0
|
||||
TEXT_THICKNESS = 2.0
|
||||
TEXT_Z_OFFSET = 3.0 # Starts on top of background
|
||||
TEXT_THICKNESS = 2.0 + 0.3 # 2.3mm (base 2.0 + 0.3mm for inset compensation)
|
||||
TEXT_Z_OFFSET = 3.0 - 0.3 # 2.7mm - starts inset into background
|
||||
CURVE_RESOLUTION = 64 # number of segments per circle
|
||||
|
||||
# SVG Class mappings
|
||||
@@ -205,6 +205,8 @@ def create_extrusion(paths, height, z_offset=0.0, scale=1.0):
|
||||
else:
|
||||
mesh = trimesh.util.concatenate(meshes)
|
||||
|
||||
|
||||
|
||||
mesh.apply_translation([0, 0, z_offset])
|
||||
return mesh
|
||||
except Exception as e:
|
||||
|
||||
27
old-new-diff.MD
Normal file
27
old-new-diff.MD
Normal file
@@ -0,0 +1,27 @@
|
||||
# Format Migration: Old to New 2.0
|
||||
|
||||
## Format Comparison
|
||||
|
||||
| Feature | Old Format (`nametags/`) | New 1.0 (`input/`) | **New 2.0 (`new/`) - Target** |
|
||||
|---------|------------------------|--------------------|--------------------------------|
|
||||
| **Grouping** | `<g>` layers (Illustrator) | Flat (no `<g>` tags) | **Semantic `<g>` tags with `id` attributes** |
|
||||
| **Coloring** | `<style>` + classes (`st1`) | Inline `fill="#00aeef"` | Inline `fill` |
|
||||
| **Classification Signal**| `class="st1"` / `st2` | `fill="#00aeef"` / `#fff` | **Parent `<g>` tag `id`** (`background`, `white-text`, `cyan-logo-text`) |
|
||||
|
||||
## Key Differences Summary
|
||||
|
||||
### Structural Changes
|
||||
- **Old**: Relies on `<g>` layers with Illustrator-generated classes like `st1`, `st2`
|
||||
- **New 1.0**: Flattened structure with inline color values but no semantic grouping
|
||||
- **New 2.0**: Semantic `<g>` tags with explicit `id` attributes on parent groups for robust classification
|
||||
|
||||
### Classification Logic Changes
|
||||
- **Old Format**: Uses `class="st1"` / `st2` attribute checks
|
||||
- **New 1.0 Format**: Uses inline `fill` color hex values (`#00aeef` / `#fff`)
|
||||
- **New 2.0 Format**: Uses parent `<g>` tag `id` attributes with semantic names (`background`, `white-text`, `cyan-logo-text`)
|
||||
|
||||
### Advantages of New 2.0 Format
|
||||
- Cleanest classification method using semantic grouping
|
||||
- More robust than exact color hex value matching
|
||||
- Better than relying on historical Illustrator class names (`st1`, `st2`)
|
||||
- Explicit functional layer grouping rather than color-based classification
|
||||
BIN
pwa-512x512.png
Normal file
BIN
pwa-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Reference in New Issue
Block a user