feat: 完善Face保持关系守门与大模型预判

This commit is contained in:
2026-08-10 16:51:52 +08:00
parent 415e8a0f27
commit 61f0b76e59
11 changed files with 218 additions and 21 deletions
+29 -1
View File
@@ -166,6 +166,19 @@ def _assert_local_scope_explains_curved_owner(specs: list[dict[str, object]], ke
raise SystemExit(f"{key}/local disabled tip should mention curved owner: {disabled_tip}")
def _assert_keep_relations_blocked(plan: dict[str, object], label: str, *expected_fragments: str) -> None:
if plan.get("status") != "blocked":
raise SystemExit(f"{label} should be blocked before execution: {plan}")
if plan.get("face_push_pull_planar_relation_constraint_requested") is not True:
raise SystemExit(f"{label} should record the requested keep-relation constraint: {plan}")
if plan.get("face_push_pull_planar_constraint_status") != "blocked":
raise SystemExit(f"{label} should expose blocked keep-relation constraint status: {plan}")
message = str(plan.get("message") or "") + " " + str(plan.get("blockers") or "")
for fragment in expected_fragments:
if fragment not in message:
raise SystemExit(f"{label} blocker should mention {fragment!r}: {plan}")
def _bbox_height(model: StepModel) -> float:
info = model.part_info(1)
bbox_size = info.get("bbox_size")
@@ -199,6 +212,12 @@ def main() -> int:
_assert_blocked(model.face_center_local_move_plan(face_id, target_center), "Face center local move")
_assert_blocked(model.face_area_local_resize_plan(face_id, area * 1.1), "Face area local resize")
_assert_blocked(model.face_plane_offset_local_plan(face_id, 1.0), "Face plane offset local move")
_assert_keep_relations_blocked(
model.push_pull_keep_relations_plan(face_id, 1.0),
"planar cylinder cap keep-relations push/pull",
"非平面",
"平面邻域",
)
specs = _specs(face_id, info)
semantics = _spec(specs, "face_edit_semantics")
@@ -206,11 +225,20 @@ def main() -> int:
raise SystemExit(f"Face edit semantics should summarize the local blocker: {semantics}")
if "曲面" not in str(semantics.get("disabled_tip") or ""):
raise SystemExit(f"Face edit semantics tip should include the curved-owner blocker: {semantics}")
for key in ("area", "face_center_position", "face_target_normal_position"):
for key in ("face_center_position", "face_target_normal_position"):
_assert_local_scope_explains_curved_owner(specs, key)
push_pull_mode = _scope_mode(specs, "face_target_normal_position", "push_pull")
if not bool(push_pull_mode.get("enabled", False)):
raise SystemExit("planar cylinder cap push/pull scope should remain available")
keep_relations_mode = _scope_mode(specs, "face_target_normal_position", "keep_relations")
if bool(keep_relations_mode.get("enabled", True)):
raise SystemExit(f"planar cylinder cap keep-relations scope should be disabled: {keep_relations_mode}")
keep_relations_tip = str(keep_relations_mode.get("disabled_tip") or "")
if "非平面" not in keep_relations_tip and "曲面" not in keep_relations_tip:
raise SystemExit(
"planar cylinder cap keep-relations disabled tip should mention non-planar adjacency: "
f"{keep_relations_tip}"
)
huge_push_plan = model.push_pull_plan(face_id, 50.0)
if huge_push_plan.get("status") == "blocked":