This script allows you to take a 2D SVG image (for example, a logo, icon, or simple vector shape) and extrude it into 3D.
You can also place it on top of a background plate to create badges, nameplates, keychains, etc.
๐น How it works
- The script loads your SVG file and scales it to a specified width (in millimeters).
- You define the aspect ratio of your SVG (height รท width) so the script knows how tall to make the background plate.
- The foreground (your SVG) and the background (optional rectangle plate) are extruded separately, so you can control their thickness and preview them in different colors.
๐น Preparing your SVG
- Your SVG should be pure vector paths (no strokes, filters, text, or clipping masks).
- In Inkscape: select everything โ Path โธ Object to Path.
- For stroked lines: use Path โธ Stroke to Path.
- Merge overlapping shapes with Path โธ Union.
- Look at your SVGโs <svg> tag or viewBox to find the width and height values.
- Compute ASPECT_RATIO = height รท width.
- Example: if viewBox = 0 0 200 100, then ASPECT_RATIO = 100/200 = 0.5.
๐น Parameters you can edit
- WIDTH โ how wide your final logo should be (everything scales from this).
- ASPECT_RATIO โ ratio from your SVG file. If your SVG is twice as tall as it is wide, use 2.0.
- SVG_EXTRUDE โ thickness of your logo.
- SHOW_BG โ turn background plate on/off.
- BG_EXTRUDE โ thickness of background.
- BG_MARGIN โ how much larger the plate is than the logo.
- Colors โ only affect the OpenSCAD preview (STL export has no color).