# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview SVG scale artwork for E440-style round-dial analog meters. The scales are designed in Inkscape (v1.4.3) using **Alte DIN 1451 Mittelschrift**, a German technical drafting standard typeface. The canvas is **93.824249 mm × 57.215687 mm**. The coordinate origin is offset: `transform="translate(-60.717741,-107.14126)"` is applied to `layer1` in all files, so absolute SVG coordinates start around x=61, y=107 rather than 0,0. ## File Roles The three SVG files represent layers of the same design, intended to be combined or used separately: - **`E440-Scale_template.svg`** — Inkscape working template. Contains the case body path (with mounting ears and rim cutout), the pivot guide circle, tick marks, numeric labels `0`–`50`, the `uA` unit label, and `Text`/`Left` and `Text`/`Right` corner label placeholders. - **`E440-Scale_paths.svg`** — Paths-only version: all tick marks and text as ``/`` elements, no live text. Used for cutting/printing workflows where fonts must not be embedded as live text. - **`E440-Scale_text.svg`** — Text-overlay version: tick mark lines plus live `` elements for numeric/corner labels (the unit label is always emitted as outline paths since it supports markup), font embedded as base64. ## Key Design Parameters - Stroke colors: `#1a1a1a` (dark near-black) for tick marks, numeric/unit/corner text; fill `#f9f9f9` for the case body; `#000000` for the rim arc stroke; `#b3b3b3` for the pivot guide circle. - Fixed case geometry (identical across every generated scale — only tick/label/text content varies): - Pivot point (local, pre-translate frame): `(107.42845, 162.62819)` - Rim / inner-tick radius: `43.842751` mm - Angular sweep: `±45.667193°` from vertical, clockwise-positive (low value on the left) - Tick radial lengths: major `4.7839203` mm, medium `3.1215858` mm, small `1.8121802` mm - Tick stroke widths: major `0.79658329`, medium `0.37985462`, small `0.27478597` - Label radius: `49.862` mm - Tick tiers: major ticks at each labeled interval boundary; a medium tick appears only when the minor-tick count per interval is odd, at the exact midpoint subdivision; all other subdivisions render as small ticks. - Numeric labels rotate to follow the arc (radial orientation), matching their tick's angle. ## Web Generator (`web/`) A Flask app that generates scale SVGs from a form. The venv lives at the repo root. ``` source .venv/bin/activate cd web && python app.py # runs on http://localhost:5000 ``` `app.py` has one route (`GET /`) serving the form and one (`POST /generate`) that returns SVG. All SVG geometry is computed in `generate_svg()` using the same coordinate constants as the hand-drawn files: ticks and labels are positioned "as if angle=0" (straight up from the pivot) and given an SVG `rotate(angle, PIVOT_X, PIVOT_Y)` transform. The form exposes: unit label, min/max values, scale mapping, major tick intervals, minor ticks per interval, number of numeric labels, custom labels, label size, font, output mode, and left/right corner labels (up to 2 lines each). Fonts are loaded at startup from every `.ttf` in `fonts/` and embedded as base64 in every generated SVG (text output mode) so output files are self-contained. The default font is `alte-din-1451-mittelschrift.regular`. ## Container & Kubernetes ``` docker build -t e440-scale:latest . ``` `fonts/` must contain the required TTF files before building. ``` kubectl apply -f k8s/ ``` `k8s/ingress.yaml` adds a Traefik `IngressRoute` for `works.baumann.gr/E440-generator` and a `stripPrefix` middleware. Adjust `certResolver` in the file if your Traefik instance uses a different name. ## Editing SVG files directly Open files in **Inkscape**. There is no build, lint, or test tooling — changes are made directly to the SVG XML or via Inkscape's GUI. When modifying tick positions or labels, keep all three files consistent.