feat: 推进一级关系参数化编辑与参数导出

This commit is contained in:
2026-08-13 17:50:20 +08:00
parent 19364d81b5
commit 7d814d2939
21 changed files with 2075 additions and 231 deletions
+64 -1
View File
@@ -27,6 +27,18 @@ class _PropertySpecProbe(WindowStateMixin):
self.manual_slot_pair_face_id = None
class _PlaneOffsetDirectionModel:
faces = (object(),)
def face_info(self, face_id: int) -> dict[str, object]:
if face_id != 0:
raise ValueError(f"unexpected face id {face_id}")
return {
"plane_origin": (4.25, -5.0, 0.0),
"push_pull_outward_direction": (0.0, -1.0, 0.0),
}
def _spec_keys(info: dict[str, object]) -> set[str]:
return {str(spec.get("key", "")) for spec in _specs(info)}
@@ -332,6 +344,36 @@ def _assert_target_change_detection() -> None:
raise SystemExit("changed vector Face target was not detected")
def _assert_plane_offset_uses_push_pull_direction() -> None:
probe = _PropertySpecProbe()
probe.model = _PlaneOffsetDirectionModel()
probe.selected_face_id = 0
info = {
"face_id": 0,
"topological_face_id": 0,
"surface": "plane",
"plane_origin": (4.25, -5.0, 0.0),
"normal": (0.0, 1.0, 0.0),
"area_center": (4.25, -5.0, 2.5),
"bbox_diagonal": 8.0,
"local_face_deform_ready": True,
"local_face_width": 1.5,
"local_face_height": 4.0,
}
specs, _used = probe._editable_property_specs(info)
offset_spec = _spec(specs, "face_target_normal_position")
current = float(offset_spec.get("current_raw"))
if abs(current - 5.0) > 1e-9:
raise SystemExit(f"plane offset should use push-pull outward direction, got current={current:g}")
push_pull = _scoped_effective_spec(specs, "face_target_normal_position", "push_pull")
distance = probe._transform_property_scalar_target(push_pull, 5.0)
if abs(distance) > 1e-9:
raise SystemExit(f"unchanged plane offset target should convert to zero distance, got {distance:g}")
inward_distance = probe._transform_property_scalar_target(push_pull, -5.0)
if abs(inward_distance + 10.0) > 1e-9:
raise SystemExit(f"opposite plane offset target should convert relative to outward current, got {inward_distance:g}")
def _assert_property_table_column_widths() -> None:
for width in (320, 340, 360, 400, 520):
columns = _property_table_column_widths(width)
@@ -369,9 +411,16 @@ def _assert_holed_plane_local_scopes_disabled() -> None:
"has_inner_boundaries": True,
"local_face_deform_ready": False,
"local_face_deform_blocker": "has inner boundary",
"local_face_size_edit_ready": False,
"local_face_size_edit_blocker": "has inner boundary",
}
)
for key in ("local_face_width", "local_face_height", "face_center_position"):
keys = {str(spec.get("key", "")) for spec in specs}
for key in ("local_face_width", "local_face_height"):
if key in keys:
raise SystemExit(f"{key} should be hidden for a holed planar Face, got {keys}")
for key in ("face_center_position",):
local_mode = _scope_mode(specs, key, "local")
if bool(local_mode.get("enabled", True)):
raise SystemExit(f"{key} local Face scope should be disabled for a holed planar Face")
@@ -438,6 +487,19 @@ def main() -> int:
"first_level_topology_note": "已识别当前 Face 区域 1 个 Face、边界 Edge 4 条、边界 Vertex 4 个、共享边一级相邻 Face 4 个。",
"topology_ignored_relation_note": "当前阶段只传播一级关系;二级、三级拓扑暂不自动递归编辑。",
}
quick_plane_display_specs = _display_specs(plane_info)
quick_plane_display_keys = {str(spec.get("key", "")) for spec in quick_plane_display_specs}
if "local_face_width" in quick_plane_display_keys or "local_face_height" in quick_plane_display_keys:
raise SystemExit(
"quick plane Face should not show面内长度/面内宽度 until local size edit is explicitly ready: "
f"{sorted(quick_plane_display_keys)}"
)
plane_info.update(
{
"local_face_size_edit_ready": True,
"local_face_size_edit_blocker": "",
}
)
plane_specs = _specs(plane_info)
plane_keys = {str(spec.get("key", "")) for spec in plane_specs}
_assert_label(plane_specs, "cad_modeling_form", "建模形式")
@@ -1217,6 +1279,7 @@ def main() -> int:
raise SystemExit(f"{key} disabled tip should explain the recognition blocker: {spec}")
_assert_target_change_detection()
_assert_plane_offset_uses_push_pull_direction()
_assert_property_table_column_widths()
_assert_holed_plane_local_scopes_disabled()
_assert_no_legacy_face_source_terms()