revert feat(engine): 鏀寔 annulus/circles profile 鐩存帴閲嶅缓涓?schema 鍚屾
This commit is contained in:
2026-08-31 16:44:59 +08:00
parent d192ac5ccd
commit 52dd2d929a
737 changed files with 6 additions and 216949 deletions
+1 -3
View File
@@ -334,13 +334,11 @@
{"if": {"properties": {"atomic_id": {"const": "hole_wizard"}}}, "then": {"properties": {"params": {"$ref": "#/$defs/holeWizardParams"}}}}
]
},
"profile_type": {"enum": ["circle", "polygon", "analytic_contours", "annulus", "circles"]},
"profile_type": {"enum": ["circle", "polygon", "analytic_contours"]},
"profile": {
"oneOf": [
{"type": "object", "properties": {"type": {"const": "circle"}, "center": {"$ref": "#/$defs/point2"}, "radius_mm": {"$ref": "#/$defs/positive"}}, "required": ["type", "radius_mm"], "additionalProperties": false},
{"type": "object", "properties": {"type": {"const": "polygon"}, "vertices": {"type": "array", "minItems": 3, "items": {"$ref": "#/$defs/point2"}}}, "required": ["type", "vertices"], "additionalProperties": false},
{"type": "object", "properties": {"type": {"const": "annulus"}, "center": {"$ref": "#/$defs/point2"}, "inner_radius_mm": {"$ref": "#/$defs/positive"}, "outer_radius_mm": {"$ref": "#/$defs/positive"}}, "required": ["type", "inner_radius_mm", "outer_radius_mm"], "additionalProperties": false},
{"type": "object", "properties": {"type": {"const": "circles"}, "items": {"type": "array", "minItems": 1, "items": {"type": "object", "properties": {"center": {"$ref": "#/$defs/point2"}, "radius_mm": {"$ref": "#/$defs/positive"}}, "required": ["radius_mm"], "additionalProperties": false}}}, "required": ["type", "items"], "additionalProperties": false},
{"$ref": "#/$defs/analyticProfile"}
]
},
+1 -12
View File
@@ -5,7 +5,7 @@
"maintenance_rule": "The CDSL-only runtime contract is limited to direct generic profiles and runtime.py EXECUTORS. Legacy macro profiles are importer compatibility syntax and must be lowered by cdsl_importer.legacy_profile_adapter before generic runtime validation.",
"coordinate_convention": "All profile dimensions use millimetres. Two-dimensional points are [u, v] in the sketch workplane.",
"runtime_supported_atomic_ids": ["extrude_add_blind", "extrude_add_two_sided", "extrude_cut_blind", "revolve_add", "revolve_cut", "hole_blind", "hole_countersink", "hole_counterbore", "sphere_add", "reference_plane", "reference_axis", "hole_wizard", "fillet", "chamfer", "pattern_linear", "pattern_mirror"],
"runtime_supported_profiles": ["circle", "polygon", "analytic_contours", "annulus", "circles"],
"runtime_supported_profiles": ["circle", "polygon", "analytic_contours"],
"feature_atomic_ids": {
"extrude_add_blind": {"summary": "Add the closed profile by one signed extrusion distance.", "required_params": ["distance_mm"], "optional_params": ["reverse"], "requires_sketch": true},
"extrude_add_two_sided": {"summary": "Add the closed profile with independently captured forward and reverse terminations.", "required_params": ["distance_mm", "reverse_distance_mm"], "optional_params": ["reverse", "end_condition", "reverse_end_condition"], "requires_sketch": true},
@@ -38,17 +38,6 @@
},
"analytic_contours": {
"summary": "Closed direct line, arc and circle contours. B-splines are unsupported."
},
"annulus": {
"summary": "A concentric ring: an outer circular boundary with an inner circular hole.",
"required": ["inner_radius_mm", "outer_radius_mm"],
"optional": ["center"],
"constraints": ["0 < inner_radius_mm < outer_radius_mm"]
},
"circles": {
"summary": "Multiple circular contours; circles nested inside another circle are interpreted as holes.",
"required": ["items"],
"constraints": ["items contains at least one circle with radius_mm > 0"]
}
}
}
+4 -50
View File
@@ -1,9 +1,9 @@
"""Core CDSL sketch resolver.
The runtime accepts only direct geometric descriptions: circles, straight-edge
polygons, closed analytic line/arc/circle contours, concentric annuli, and
multi-circle sets. Semantic shapes and historical profile macros belong to the
importer compatibility layer and must be lowered before this module is invoked.
polygons, and closed analytic line/arc/circle contours. Semantic shapes and
historical profile macros belong to the importer compatibility layer and must
be lowered before this module is invoked.
"""
from __future__ import annotations
@@ -276,58 +276,12 @@ def _gen_analytic_contours(profile: _Ctx, meta: _Ctx) -> tuple[list[_Ctx], list[
return entities, []
def _gen_annulus(profile: _Ctx, meta: _Ctx) -> tuple[list[_Ctx], list[_Ctx]]:
"""annulus: 同心圆环,由内外两个实体圆组成。
与 legacy 链路(legacy_profiles._gen_annulus)同构:只产出圆实体、
不产轮廓边,建面交给 adapter 的 _faces_from_circles(内圆被外圆包含
→ 作为孔洞打掉,得到环面)。
"""
center = profile.get("center") or [0.0, 0.0]
inner_radius = float(profile.get("inner_radius_mm") or 0.0)
outer_radius = float(profile.get("outer_radius_mm") or 0.0)
if inner_radius <= 0 or outer_radius <= 0:
raise ValueError("annulus: radii must be > 0")
if inner_radius >= outer_radius:
raise ValueError("annulus: inner_radius must be < outer_radius")
cx, cy = float(center[0]), float(center[1])
return [_circle([cx, cy], inner_radius), _circle([cx, cy], outer_radius)], []
def _gen_circles(profile: _Ctx, meta: _Ctx) -> tuple[list[_Ctx], list[_Ctx]]:
"""circles: 多圆轮廓,每个圆一个实体圆(互不相交时为独立面)。
与 legacy 链路(legacy_profiles._gen_circles)同构:只产出圆实体、
不产轮廓边,建面交给 adapter 的 _faces_from_circles(按圆间包含关系
识别孔洞,被包含的圆跳过、直接包含的圆作为孔洞)。
"""
items = profile.get("items") or []
if not items:
raise ValueError("circles: items must be non-empty")
entities: list[_Ctx] = []
for item in items:
center = item.get("center") or [0.0, 0.0]
radius = float(item.get("radius_mm") or 0.0)
if radius <= 0:
raise ValueError("circles: radius_mm must be > 0")
entities.append(_circle([float(center[0]), float(center[1])], radius))
return entities, []
CORE_SHAPE_GENERATORS: dict[str, Any] = {
"circle": _gen_circle,
"polygon": _gen_polygon,
"analytic_contours": _gen_analytic_contours,
"annulus": _gen_annulus,
"circles": _gen_circles,
}
CORE_SHAPE_GENERATORS: dict[str, Any] = {"circle": _gen_circle, "polygon": _gen_polygon, "analytic_contours": _gen_analytic_contours}
SHAPE_GENERATORS = CORE_SHAPE_GENERATORS
SHAPE_CAPABILITIES: dict[str, _Ctx] = {
"circle": {"detectable": True, "arity": "circle", "description": "single circular contour"},
"polygon": {"detectable": True, "arity": "polygon", "description": "closed straight-edge contour"},
"analytic_contours": {"detectable": True, "arity": "analytic", "description": "closed line, arc, and circle contours"},
"annulus": {"detectable": True, "arity": "annulus", "description": "concentric inner and outer circular contours"},
"circles": {"detectable": True, "arity": "circles", "description": "multiple circular contours with hole nesting"},
}