From 98d208ae5d0a646355ec3a976e89b6689b465766 Mon Sep 17 00:00:00 2001 From: ganjihong Date: Wed, 26 Aug 2026 18:18:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(json=5Fto=5Fcdsl):=20=E5=A4=9A=E5=9C=86?= =?UTF-8?q?=E8=BD=AE=E5=BB=93=E6=94=B9=E4=B8=BA=20analytic=5Fcontours=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- json_to_cdsl/evidence_v2_to_cdsl.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/json_to_cdsl/evidence_v2_to_cdsl.py b/json_to_cdsl/evidence_v2_to_cdsl.py index 1012ad55..4efed0c8 100644 --- a/json_to_cdsl/evidence_v2_to_cdsl.py +++ b/json_to_cdsl/evidence_v2_to_cdsl.py @@ -414,7 +414,16 @@ def _analytic_profile(sketch: dict[str, Any]) -> dict[str, Any]: smaller, larger = sorted(drawable, key=lambda item: item["radius_mm"]) return {"type": "annulus", "center": larger["center"], "inner_radius_mm": smaller["radius_mm"], "outer_radius_mm": larger["radius_mm"]} if drawable and all(item["type"] == "circle" for item in drawable): - return {"type": "circles", "items": [{"center": item["center"], "radius_mm": item["radius_mm"]} for item in drawable]} + # Multiple independent circles share the "extrude every closed loop" intent; + # emit them as analytic_contours (one outer contour per circle) so the + # generic runtime profile contract accepts the record. + return { + "type": "analytic_contours", + "contours": [ + {"role": "outer", "closed": True, "segments": [item]} + for item in drawable + ], + } contours = _chain_segments(drawable) areas = [_contour_area(contour) for contour in contours]