几何引擎新增open_slot功能。

This commit is contained in:
2026-09-07 16:44:06 +08:00
parent 9160c2bace
commit 9a3e09b9f5
6 changed files with 44 additions and 13 deletions
+9 -1
View File
@@ -156,7 +156,15 @@ def validate_cdsl(cdsl: dict[str, Any], engine: Any) -> None:
for parameter_name in contract.get("required_params") or []:
if params.get(parameter_name) is None:
raise ValueError(f"Feature {fid} ({atomic_id}) is missing required parameter: {parameter_name}")
if atomic_id.startswith("extrude_") and float(params.get("distance_mm") or 0) <= 0:
# 距离检查只对"以 distance_mm 驱动"的 extrude 契约生效:extrude_cut_through
# 等贯通型契约的作者参数不含 distance_mm(以 end_condition 表达贯通),
# 不能按盲切假设要求距离。用契约声明判定,避免硬编码原子名单漂移。
author_props = (contract.get("author_params_schema") or {}).get("properties") or {}
if (
atomic_id.startswith("extrude_")
and "distance_mm" in author_props
and float(params.get("distance_mm") or 0) <= 0
):
raise ValueError(f"Feature {fid} ({atomic_id}) requires distance_mm > 0 for runtime rebuild")
if atomic_id.startswith("revolve_") and float(params.get("angle_deg") or 0) <= 0:
raise ValueError(f"Feature {fid} ({atomic_id}) requires angle_deg > 0 for runtime rebuild")