kerf-engine/engine/output/svg.py
jlightner 9540f37f70 test: Wire post-processing into /engine/trace, add output_format routin…
- "engine/api/routes.py"
- "engine/tests/test_api.py"

GSD-Task: S02/T03
2026-03-26 04:39:52 +00:00

22 lines
739 B
Python

"""SVG output generator — clean SVG serialization from PostProcessResult."""
from __future__ import annotations
from pipeline.postprocess import PostProcessResult
def generate_svg(result: PostProcessResult) -> str:
"""Generate a clean SVG string from post-processed path data.
Re-serializes paths from the PostProcessResult into a minimal SVG document
with a single compound path using fill-rule="evenodd" for proper island rendering.
Args:
result: PostProcessResult from the post-processing pipeline.
Returns:
SVG string with simplified paths.
"""
# The postprocess pipeline already rebuilds SVG; return it directly
# if caller just wants the default output.
return result.svg