save_drawing_annotations
Preserve label metadata from build123d drawings by saving annotations as a sidecar JSON file alongside the SVG, enabling later inspection and restoration of text content.
Instructions
Write a .dims.json sidecar file alongside an SVG with label metadata.
build123d renders Text as filled glyph paths, not <text> SVG elements, so
label strings are irrecoverable from a finished SVG. Call this tool after
completing a drawing (annotate all dims/leaders with annotate()) and before
or after exporting the SVG. The sidecar is read automatically by
inspect_drawing(svg_path=...) to restore annotation content.
Workflow:
1. Build your drawing with Dimension / Leader / annotate()
2. Export SVG: execute("exporter.write('drawing.svg')")
3. Save metadata: save_drawing_annotations("drawing.svg")
4. Inspect later: inspect_drawing(svg_path="drawing.svg")
→ includes full annotations dict from the sidecar
Args:
svg_path: path to the SVG file (sidecar written as <svg_path>.dims.json).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| svg_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |