feat: 扩展Face保持关系编辑语义
This commit is contained in:
@@ -1507,10 +1507,13 @@ class WindowActionMixin:
|
||||
"面面积(缩放特征)",
|
||||
"面内长度(局部重建)",
|
||||
"面内宽度(局部重建)",
|
||||
"面内长度(保持关系)",
|
||||
"面内宽度(保持关系)",
|
||||
"面内长度(缩放特征)",
|
||||
"面内宽度(缩放特征)",
|
||||
"偏移(局部重建)",
|
||||
"中心(局部重建)",
|
||||
"中心(保持关系)",
|
||||
"圆柱高度调整",
|
||||
"高度(缩放特征)缩放所属对象",
|
||||
}
|
||||
@@ -1531,8 +1534,10 @@ class WindowActionMixin:
|
||||
"resize_face_area_local",
|
||||
"resize_face_area",
|
||||
"resize_face_size_local",
|
||||
"resize_face_size_local_keep_relations",
|
||||
"resize_face_size_owning_scale",
|
||||
"move_face_center_local",
|
||||
"move_face_center_local_keep_relations",
|
||||
"resize_shell_thickness",
|
||||
"resize_shell_thickness_owning_scale",
|
||||
"resize_cylindrical_height",
|
||||
@@ -5920,10 +5925,16 @@ class WindowActionMixin:
|
||||
)
|
||||
|
||||
def resize_face_width_local(self) -> None:
|
||||
self._resize_face_size_local("width")
|
||||
self._resize_face_size_local("width", keep_relations=False)
|
||||
|
||||
def resize_face_height_local(self) -> None:
|
||||
self._resize_face_size_local("height")
|
||||
self._resize_face_size_local("height", keep_relations=False)
|
||||
|
||||
def resize_face_width_keep_relations(self) -> None:
|
||||
self._resize_face_size_local("width", keep_relations=True)
|
||||
|
||||
def resize_face_height_keep_relations(self) -> None:
|
||||
self._resize_face_size_local("height", keep_relations=True)
|
||||
|
||||
def resize_face_width_owning_scale(self) -> None:
|
||||
self._resize_face_size_owning_scale("width")
|
||||
@@ -5931,12 +5942,13 @@ class WindowActionMixin:
|
||||
def resize_face_height_owning_scale(self) -> None:
|
||||
self._resize_face_size_owning_scale("height")
|
||||
|
||||
def _resize_face_size_local(self, axis: str) -> None:
|
||||
def _resize_face_size_local(self, axis: str, *, keep_relations: bool) -> None:
|
||||
if self.model is None:
|
||||
return
|
||||
axis_key = "height" if str(axis).lower() == "height" else "width"
|
||||
axis_label = "面内宽度" if axis_key == "height" else "面内长度"
|
||||
if self._edit_busy(f"请等待当前编辑完成后再修改{axis_label}(局部重建)。"):
|
||||
mode_label = f"{axis_label}(保持关系)" if keep_relations else f"{axis_label}(局部重建)"
|
||||
if self._edit_busy(f"请等待当前编辑完成后再修改{mode_label}。"):
|
||||
return
|
||||
if self.selected_face_id is None:
|
||||
QMessageBox.information(self, "未选择Face", "请先选择一个平面 Face。")
|
||||
@@ -5953,10 +5965,13 @@ class WindowActionMixin:
|
||||
face_id = self.selected_face_id
|
||||
plan = self._quick_blocked_face_size_local_plan(face_id, target_size, axis_key)
|
||||
if plan is None:
|
||||
plan = self.model.face_size_local_resize_plan(face_id, target_size, axis_key)
|
||||
if keep_relations:
|
||||
plan = self.model.face_size_local_resize_keep_relations_plan(face_id, target_size, axis_key)
|
||||
else:
|
||||
plan = self.model.face_size_local_resize_plan(face_id, target_size, axis_key)
|
||||
lines = [
|
||||
f"Face: {face_id}",
|
||||
f"修改对象: {axis_label}(局部重建)",
|
||||
f"修改对象: {mode_label}",
|
||||
f"当前面内长度: {_format_value(plan.get('current_face_width'))}",
|
||||
f"目标面内长度: {_format_value(plan.get('target_face_width'))}",
|
||||
f"当前面内宽度: {_format_value(plan.get('current_face_height'))}",
|
||||
@@ -5970,21 +5985,23 @@ class WindowActionMixin:
|
||||
f"影响目标: {_format_value(plan.get('local_face_deform_target_kind'))}",
|
||||
]
|
||||
if not self._confirm_quick_edit_plan(
|
||||
f"{axis_label}(局部重建)",
|
||||
mode_label,
|
||||
plan,
|
||||
lines,
|
||||
f"{axis_label}(局部重建)已阻止",
|
||||
f"已取消{axis_label}(局部重建)",
|
||||
f"{mode_label}已阻止",
|
||||
f"已取消{mode_label}",
|
||||
):
|
||||
return
|
||||
self.clear_edit_preview(render=False)
|
||||
|
||||
def action():
|
||||
if keep_relations:
|
||||
return self.model.resize_face_size_local_keep_relations(face_id, target_size, axis_key)
|
||||
return self.model.resize_face_size_local(face_id, target_size, axis_key)
|
||||
|
||||
self._run_edit_action(
|
||||
action,
|
||||
operation_name=f"修改{axis_label}(局部重建)",
|
||||
operation_name=f"修改{mode_label}",
|
||||
target=f"Face {face_id}",
|
||||
parameters={
|
||||
"face_id": face_id,
|
||||
@@ -6013,6 +6030,11 @@ class WindowActionMixin:
|
||||
"resize_strategy": plan.get("resize_strategy"),
|
||||
"edit_strategy_label": plan.get("edit_strategy_label"),
|
||||
"edit_semantics": plan.get("edit_semantics"),
|
||||
"face_planar_relation_constraint_requested": plan.get("face_planar_relation_constraint_requested"),
|
||||
"face_push_pull_planar_constraint_summary": plan.get("face_push_pull_planar_constraint_summary"),
|
||||
"face_push_pull_planar_constraint_parallel_count": plan.get("face_push_pull_planar_constraint_parallel_count"),
|
||||
"face_push_pull_planar_constraint_perpendicular_count": plan.get("face_push_pull_planar_constraint_perpendicular_count"),
|
||||
"face_push_pull_planar_constraint_angled_count": plan.get("face_push_pull_planar_constraint_angled_count"),
|
||||
"resize_status": plan.get("status"),
|
||||
"resize_risk": plan.get("risk"),
|
||||
"resize_message": plan.get("message"),
|
||||
@@ -6022,7 +6044,11 @@ class WindowActionMixin:
|
||||
},
|
||||
target_kind="face",
|
||||
target_id=face_id,
|
||||
isolation=self._isolation_for_plan(plan, "resize_face_size_local", [face_id, target_size, axis_key]),
|
||||
isolation=self._isolation_for_plan(
|
||||
plan,
|
||||
"resize_face_size_local_keep_relations" if keep_relations else "resize_face_size_local",
|
||||
[face_id, target_size, axis_key],
|
||||
),
|
||||
)
|
||||
|
||||
def _resize_face_size_owning_scale(self, axis: str) -> None:
|
||||
@@ -6361,9 +6387,16 @@ class WindowActionMixin:
|
||||
)
|
||||
|
||||
def move_selected_face_center_local(self) -> None:
|
||||
self._move_selected_face_center_local(keep_relations=False)
|
||||
|
||||
def move_selected_face_center_keep_relations(self) -> None:
|
||||
self._move_selected_face_center_local(keep_relations=True)
|
||||
|
||||
def _move_selected_face_center_local(self, *, keep_relations: bool) -> None:
|
||||
if self.model is None:
|
||||
return
|
||||
if self._edit_busy("请等待当前编辑完成后再执行中心(局部重建)。"):
|
||||
mode_label = "中心(保持关系)" if keep_relations else "中心(局部重建)"
|
||||
if self._edit_busy(f"请等待当前编辑完成后再执行{mode_label}。"):
|
||||
return
|
||||
if self.selected_face_id is None:
|
||||
QMessageBox.information(self, "未选择Face", "请先选择一个平面 Face。")
|
||||
@@ -6378,9 +6411,9 @@ class WindowActionMixin:
|
||||
current_center = self._selected_face_center_for_translation(face_id)
|
||||
if current_center is None:
|
||||
self._show_immediate_cannot_edit_message(
|
||||
"中心(局部重建)",
|
||||
mode_label,
|
||||
"当前 Face 缺少稳定中心坐标。",
|
||||
"中心(局部重建)已阻止",
|
||||
f"{mode_label}已阻止",
|
||||
)
|
||||
return
|
||||
target_center = (
|
||||
@@ -6390,7 +6423,10 @@ class WindowActionMixin:
|
||||
)
|
||||
plan = self._quick_blocked_face_center_local_plan(face_id, target_center)
|
||||
if plan is None:
|
||||
plan = self.model.face_center_local_move_plan(face_id, target_center)
|
||||
if keep_relations:
|
||||
plan = self.model.face_center_local_move_keep_relations_plan(face_id, target_center)
|
||||
else:
|
||||
plan = self.model.face_center_local_move_plan(face_id, target_center)
|
||||
lines = [
|
||||
f"Face: {face_id}",
|
||||
f"当前 Face 中心: {_format_value(plan.get('current_face_center'))}",
|
||||
@@ -6403,21 +6439,23 @@ class WindowActionMixin:
|
||||
f"影响目标: {_format_value(plan.get('local_face_deform_target_kind'))}",
|
||||
]
|
||||
if not self._confirm_quick_edit_plan(
|
||||
"中心(局部重建)",
|
||||
mode_label,
|
||||
plan,
|
||||
lines,
|
||||
"中心(局部重建)已阻止",
|
||||
"已取消中心(局部重建)",
|
||||
f"{mode_label}已阻止",
|
||||
f"已取消{mode_label}",
|
||||
):
|
||||
return
|
||||
self.clear_edit_preview(render=False)
|
||||
|
||||
def action():
|
||||
if keep_relations:
|
||||
return self.model.move_face_center_local_keep_relations(face_id, target_center)
|
||||
return self.model.move_face_center_local(face_id, target_center)
|
||||
|
||||
self._run_edit_action(
|
||||
action,
|
||||
operation_name="中心(局部重建)",
|
||||
operation_name=mode_label,
|
||||
target=f"Face {face_id}",
|
||||
parameters={
|
||||
"face_id": face_id,
|
||||
@@ -6436,6 +6474,11 @@ class WindowActionMixin:
|
||||
"resize_strategy": plan.get("resize_strategy"),
|
||||
"edit_strategy_label": plan.get("edit_strategy_label"),
|
||||
"edit_semantics": plan.get("edit_semantics"),
|
||||
"face_planar_relation_constraint_requested": plan.get("face_planar_relation_constraint_requested"),
|
||||
"face_push_pull_planar_constraint_summary": plan.get("face_push_pull_planar_constraint_summary"),
|
||||
"face_push_pull_planar_constraint_parallel_count": plan.get("face_push_pull_planar_constraint_parallel_count"),
|
||||
"face_push_pull_planar_constraint_perpendicular_count": plan.get("face_push_pull_planar_constraint_perpendicular_count"),
|
||||
"face_push_pull_planar_constraint_angled_count": plan.get("face_push_pull_planar_constraint_angled_count"),
|
||||
"resize_status": plan.get("status"),
|
||||
"resize_risk": plan.get("risk"),
|
||||
"resize_message": plan.get("message"),
|
||||
@@ -6445,7 +6488,11 @@ class WindowActionMixin:
|
||||
},
|
||||
target_kind="face",
|
||||
target_id=face_id,
|
||||
isolation=self._isolation_for_plan(plan, "move_face_center_local", [face_id, list(target_center)]),
|
||||
isolation=self._isolation_for_plan(
|
||||
plan,
|
||||
"move_face_center_local_keep_relations" if keep_relations else "move_face_center_local",
|
||||
[face_id, list(target_center)],
|
||||
),
|
||||
)
|
||||
|
||||
def move_selected_axis_center_by_translation(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user