56 lines
3.3 KiB
Markdown
56 lines
3.3 KiB
Markdown
# 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 M1730 analog meters. The scales are designed in Inkscape (v1.4.3) using the **ГОСТ тип А** (GOST type A) font, a Russian technical drafting standard typeface.
|
||
|
||
All canvas dimensions are **157.18373 mm × 26.683672 mm**. The coordinate origin is offset: `transform="translate(-37.352226,-90.454928)"` is applied to `layer1` in all files, so absolute SVG coordinates start around x=37, y=90 rather than 0,0.
|
||
|
||
## File Roles
|
||
|
||
The three SVG files represent layers of the same design, intended to be combined or used separately:
|
||
|
||
- **`M1730-Scale_template.svg`** — Inkscape working template. Contains the background rect+cutout path, the zero tick mark, an end tick mark, the "U" axis label, numeric labels `0` and `X` (placeholder for the full-scale value), and a `5mA` range label. Also contains a `<rect id="rect5">` inside `<defs>` used as a text flow shape (`shape-inside:url(#rect5)`) for the title text block (`id="text5"`).
|
||
- **`M1730-Scale_paths.svg`** — Paths-only version: all tick marks as `<path>` elements, no text nodes (or text converted to paths). Used for cutting/printing workflows where fonts must not be embedded as live text.
|
||
- **`M1730-Scale_text.svg`** — Text-overlay version: tick mark paths plus live `<text>` elements for numeric labels. The `sodipodi:docname` is `M1730-Scale.svg`, suggesting this is the "final" named file.
|
||
|
||
## Key Design Parameters
|
||
|
||
- Stroke colors: `#1a1a1a` (dark near-black) for all scale lines and text; fill `#f9f9f9` for the background panel, `#ffffff` for tick mark strokes.
|
||
- Major tick stroke-width: `0.555`; border stroke-width: `0.184`.
|
||
- Scale bar (the colored strip below tick marks): `y` range 107.547–113.746 mm absolute, `x` range 58.444–183.644.
|
||
- Zero tick at absolute x=60.844; full-scale tick at x=180.251.
|
||
|
||
## 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. The form exposes: unit label, min/max values, major tick intervals, minor ticks per interval, number of numeric labels, and range label.
|
||
|
||
The ГОСТ тип А font is loaded at startup from `/usr/local/share/fonts/г/ГОСТ_тип_А.ttf` and embedded as base64 in every generated SVG so output files are self-contained.
|
||
|
||
## Container & Kubernetes
|
||
|
||
```
|
||
docker build -t m1730-scale:latest .
|
||
```
|
||
|
||
`fonts/ГОСТ_тип_А.ttf` must exist in the repo root before building (copy from `/usr/local/share/fonts/г/`). The image runs gunicorn on port 5000.
|
||
|
||
```
|
||
kubectl apply -f k8s/
|
||
```
|
||
|
||
`k8s/ingress.yaml` adds a Traefik `IngressRoute` for `works.baumann.gr/M1730-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.
|