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
+13 -1
View File
@@ -168,7 +168,11 @@ def _assert_cube_edge_intent_geometry(
f"source_count={source_count}, slanted_count={slanted_count}, "
f"expected_slanted={expected_slanted:g}, lengths={_length_distribution_from_values(lengths)}"
)
elif strategy in {"move-edge-end-plane-by-push-pull", "scale-owning-shape-from-edge"}:
elif strategy in {
"move-edge-end-plane-by-push-pull",
"keep-first-level-planar-relations",
"scale-owning-shape-from-edge",
}:
if target_count != 4 or source_count != 8:
raise SystemExit(
f"{strategy} should resize the whole cube span in the selected Edge direction; "
@@ -195,6 +199,7 @@ def main() -> int:
"auto",
"local-edge-only-deform",
"move-edge-end-plane-by-push-pull",
"keep-first-level-planar-relations",
"scale-owning-shape-from-edge",
],
help="Requested Edge length edit semantics.",
@@ -220,6 +225,8 @@ def main() -> int:
expected_strategy = args.expect_strategy or args.strategy
if expected_strategy == "auto":
expected_strategy = strategy
if expected_strategy == "keep-first-level-planar-relations":
expected_strategy = "move-edge-end-plane-by-push-pull"
if strategy != expected_strategy:
raise SystemExit(f"expected {expected_strategy}, got {strategy or '<none>'}")
if strategy == "move-edge-end-plane-by-push-pull" and plan.get("edge_length_planar_constraint_status") != "ready":
@@ -228,6 +235,11 @@ def main() -> int:
f"status={plan.get('edge_length_planar_constraint_status')}, "
f"blockers={plan.get('edge_length_planar_constraint_blockers')}"
)
if args.strategy == "keep-first-level-planar-relations":
if plan.get("edge_length_planar_relation_constraint_requested") is not True:
raise SystemExit(f"keep-planar-relations plan should preserve explicit constraint intent: {plan}")
if "保持一级平面关系" not in str(plan.get("edge_length_strategy_label") or ""):
raise SystemExit(f"keep-planar-relations plan should use a clear user-facing label: {plan}")
result = model.resize_general_edge_length(
edge_id,