feat: 增强一级关系识别与保持关系策略

This commit is contained in:
2026-08-10 14:56:50 +08:00
parent 12250603dd
commit 83c44265ba
24 changed files with 3460 additions and 241 deletions
@@ -72,6 +72,18 @@ def _assert_edge_topology(model: StepModel, edge_id: int) -> dict[str, object]:
int(topology.get("first_level_edge_count", 0) or 0) == 5,
f"cube Edge first-level Edge set should contain selected Edge + 4 neighbors: {topology}",
)
_assert(
topology.get("first_level_planar_relation_status") == "ready",
f"cube Edge should expose first-level planar relation facts: {topology}",
)
_assert(
int(topology.get("first_level_planar_relation_parallel_count", 0) or 0) >= 2,
f"cube Edge should have two incident Faces parallel to the Edge direction: {topology}",
)
_assert(
int(topology.get("first_level_planar_relation_perpendicular_count", 0) or 0) >= 1,
f"cube Edge incident Faces should be perpendicular to each other: {topology}",
)
ignored = tuple(topology.get("topology_ignored_relation_depths", ()) or ())
_assert("second-level" in ignored and "third-level" in ignored, f"missing ignored depths: {topology}")
return topology
@@ -93,6 +105,16 @@ def _assert_edge_facts(facts: dict[str, object], label: str) -> None:
_assert(int(facts.get("first_level_fact_adjacent_face_count", 0) or 0) == 2, f"{label}: bad adjacent Faces")
_assert(int(facts.get("first_level_fact_included_edge_count", 0) or 0) == 5, f"{label}: bad included Edges")
_assert(str(facts.get("first_level_fact_summary") or ""), f"{label}: missing summary")
_assert(facts.get("first_level_planar_relation_status") == "ready", f"{label}: missing planar relation facts")
_assert(
int(facts.get("first_level_planar_relation_parallel_count", 0) or 0) >= 2,
f"{label}: expected incident Faces parallel to selected Edge direction",
)
_assert(
int(facts.get("first_level_planar_relation_perpendicular_count", 0) or 0) >= 1,
f"{label}: expected perpendicular incident Face relation",
)
_assert("一级平面关系" in str(facts.get("first_level_fact_summary") or ""), f"{label}: missing relation summary")
def _assert_plan_facts(plan: dict[str, object], label: str) -> None:
@@ -111,6 +133,9 @@ def main() -> int:
"edge_first_level_topology",
"first_level_vertex_count",
"first_level_adjacent_edge_count",
"first_level_planar_relation_summary",
"first_level_planar_relation_parallel_count",
"first_level_planar_relation_perpendicular_count",
):
_assert(key in INFO_LABELS, f"{key} should have a user-facing label")