--- title: FSF Plasma Design Studio emoji: 🔥 colorFrom: yellow colorTo: gray sdk: docker app_port: 7860 pinned: false short_description: Reference image to cut-ready DXF for Full Send Fabrication --- # FSF Plasma Design Studio A web app for the client-facing design loop: **reference image → auto-trace → real-world dimensions → DXF/SVG for the plasma table.** Built for **Full Send Fabrication** (Marshall) by Larame. ## What it does 1. Add a layer per reference image. Each layer is independently uploaded and segmented. 2. Pick a per-layer mask mode: - **Smart subject extraction** (uses U-2-Net via `rembg`) gives a clean foreground silhouette regardless of lighting nuance. Best on photographs. - **Auto threshold (Otsu)** picks the optimal threshold automatically. Good on already-clean B&W reference art. - **Manual** threshold + blur + invert sliders for full control. 3. Position and scale each layer on the panel canvas: drag to move, drag the orange handle to resize, or type exact inches into the editor. 4. Set panel dimensions in inches (Width × Height). 5. Click **Compose & trace** to combine all visible layers into a single panel-sized bitmap, trace it, and analyze it. 6. Pick design intent (cutouts vs silhouette) and the analyzer flags cuttability problems: - Thin features below the minimum (default 0.1″ or 1.5× kerf, configurable) shown in red. - In silhouette mode, floating steel pieces not connected to the main piece (would fall out mid-cut) shown in orange. 7. Download SVG (universal vector) or DXF (LWPOLYLINE on a CUT layer, R2010, inches) for the plasma table. ## Run it ``` ./run.sh ``` Then open http://127.0.0.1:5174. First time only: ``` python3 -m pip install -r requirements.txt ``` ## Stack - **Flask** serves the single-page UI and the trace/analyze/export endpoints. - **rembg** (U-2-Net via ONNX Runtime) does subject extraction. Model auto-downloads to `~/.u2net/u2net.onnx` on first use (~170MB). - **potracer** (pure Python Potrace port) does the auto-trace. - **scipy.ndimage** does the distance-transform (thin-feature detection) and connected-component labeling (floating-island detection). - **ezdxf** writes plasma-friendly DXF. - **Pillow + numpy** handle image prep. No build step, no Node, no database. One command, runs offline. ## DXF notes for Marshall's machine Currently exports R2010 with LWPOLYLINE entities on a `CUT` layer, units inches, beziers flattened to 32-segment polylines. If his plasma software wants a different DXF flavor (R12, polyline arcs, splines, mm units, different layer name), the only thing that changes is `export_dxf` in `app.py` — the rest of the pipeline doesn't care.