优化生成流程

This commit is contained in:
2026-08-25 17:41:24 +08:00
parent 51575161dc
commit beaa5dd9fe
50 changed files with 4204 additions and 4261 deletions
@@ -21,6 +21,13 @@ def _workplane() -> dict:
return {"origin_mm": [0, 0, 0], "x_dir": [1, 0, 0], "normal": [0, 0, 1]}
def _rectangle(minimum: list[float], maximum: list[float]) -> dict:
return {"type": "polygon", "vertices": [
[minimum[0], minimum[1]], [maximum[0], minimum[1]],
[maximum[0], maximum[1]], [minimum[0], maximum[1]],
]}
class EngineRuntimeFoundationTests(unittest.TestCase):
def _base_block(self) -> dict:
return {
@@ -28,7 +35,7 @@ class EngineRuntimeFoundationTests(unittest.TestCase):
"meta": {"unit": "mm"},
"geometry": {"sketches": [{
"id": "base", "workplane": _workplane(),
"profile": {"type": "rectangle", "center": [0, 0], "width_mm": 10, "height_mm": 10},
"profile": _rectangle([-5, -5], [5, 5]),
}]},
"features": [{
"id": "base_add", "atomic_id": "extrude_add_blind", "depends_on": [],
@@ -490,7 +497,7 @@ class EngineRuntimeFoundationTests(unittest.TestCase):
"schema": "cad.cdsl.llm.v1", "schema_version": "1.1.0", "kind": "part", "part_id": "mirror-test",
"meta": {"unit": "mm"},
"geometry": {"sketches": [
{"id": "base", "workplane": _workplane(), "profile": {"type": "rectangle", "center": [0, 0], "width_mm": 10, "height_mm": 10}},
{"id": "base", "workplane": _workplane(), "profile": _rectangle([-5, -5], [5, 5])},
{"id": "cut", "workplane": _workplane(), "profile": {"type": "circle", "center": [2, 0], "radius_mm": 1}},
]},
"features": [
@@ -518,7 +525,7 @@ class EngineRuntimeFoundationTests(unittest.TestCase):
"schema": "cad.cdsl.llm.v1",
"geometry": {"sketches": [{
"id": "circles", "workplane": _workplane(),
"profile": {"type": "circles", "items": [{"center": [2, 3], "radius_mm": 1}]},
"profile": {"type": "circle", "center": [2, 3], "radius_mm": 1},
}]},
"features": [],
}
@@ -761,7 +768,7 @@ class EngineRuntimeFoundationTests(unittest.TestCase):
"meta": {"unit": "mm"},
"geometry": {"sketches": [{
"id": "profile", "workplane": _workplane(),
"profile": {"type": "rectangle", "min_mm": [2, 1], "max_mm": [4, 2]},
"profile": _rectangle([2, 1], [4, 2]),
}]},
"features": [
{