feat: 推进一级关系参数化编辑与参数导出
This commit is contained in:
@@ -1640,7 +1640,8 @@ class WindowCoreMixin:
|
||||
if edge_ids:
|
||||
edge_polydata = self.model.build_edge_polydata(edge_ids=edge_ids)
|
||||
elif self.selected_kind == "face" and self.selected_face_id is not None:
|
||||
face_polydata = self._cached_face_overlay_polydata(face_ids=[self.selected_face_id], smooth=False)
|
||||
face_ids = self._selection_same_domain_face_ids(self.selected_face_id) or [self.selected_face_id]
|
||||
face_polydata = self._cached_face_overlay_polydata(face_ids=face_ids, smooth=False)
|
||||
elif self.selected_kind == "edge" and self.selected_edge_id is not None:
|
||||
edge_polydata = self._cached_edge_overlay_polydata(self.selected_edge_id)
|
||||
|
||||
@@ -1675,7 +1676,8 @@ class WindowCoreMixin:
|
||||
face_ids = _int_values(info.get("feature_highlight_face_ids")) or [self.selected_face_id]
|
||||
self._highlight_faces(face_ids=face_ids)
|
||||
elif self.selected_kind == "face" and self.selected_face_id is not None:
|
||||
self._highlight_faces(face_ids=[self.selected_face_id])
|
||||
face_ids = self._selection_same_domain_face_ids(self.selected_face_id) or [self.selected_face_id]
|
||||
self._highlight_faces(face_ids=face_ids)
|
||||
elif self.selected_kind == "edge" and self.selected_edge_id is not None:
|
||||
self._highlight_edge(self.selected_edge_id)
|
||||
|
||||
@@ -1871,6 +1873,7 @@ class WindowCoreMixin:
|
||||
self.model_actor.GetProperty().SetSpecular(0.25)
|
||||
self.model_actor.GetProperty().SetSpecularPower(18)
|
||||
self.model_actor.GetProperty().SetInterpolationToPhong()
|
||||
self.model_actor.GetProperty().EdgeVisibilityOff()
|
||||
backface_property = vtk.vtkProperty()
|
||||
backface_property.SetColor(0.58, 0.62, 0.64)
|
||||
backface_property.SetDiffuse(0.9)
|
||||
@@ -2623,7 +2626,7 @@ class WindowCoreMixin:
|
||||
info.setdefault("feature_mode", "当前是几何候选判断,不等同于 CAD 历史特征")
|
||||
highlight_face_ids = _int_values(info.get("feature_highlight_face_ids")) or [face_id]
|
||||
else:
|
||||
highlight_face_ids = [face_id]
|
||||
highlight_face_ids = self._selection_same_domain_face_ids(face_id) or [face_id]
|
||||
selection_fields = self._selection_identity_fields(
|
||||
face_id,
|
||||
"特征来源 Face" if feature_mode else "Face",
|
||||
@@ -2643,6 +2646,21 @@ class WindowCoreMixin:
|
||||
message = f"已选择Face {logical_id}{raw_note}" if not feature_mode else f"已选择特征来源 Face {logical_id}{raw_note}"
|
||||
self.statusBar().showMessage(self._selection_status(message, pick_position))
|
||||
|
||||
def _selection_same_domain_face_ids(self, face_id: int) -> list[int]:
|
||||
if self.model is None:
|
||||
return [face_id]
|
||||
try:
|
||||
face_ids = self.model.face_region_ids(face_id)
|
||||
except Exception:
|
||||
face_ids = []
|
||||
if not face_ids:
|
||||
try:
|
||||
face_ids = self.model.connected_same_domain_face_ids(face_id)
|
||||
except Exception:
|
||||
face_ids = []
|
||||
face_ids = sorted({int(item) for item in face_ids if 0 <= int(item) < len(self.model.faces)})
|
||||
return face_ids or [face_id]
|
||||
|
||||
def select_feature(self, face_id: int, pick_position: tuple[float, float, float] | None = None) -> None:
|
||||
if self.model is None:
|
||||
return
|
||||
@@ -2872,6 +2890,7 @@ class WindowCoreMixin:
|
||||
actor.GetProperty().SetSpecular(0.35)
|
||||
actor.GetProperty().SetInterpolationToPhong()
|
||||
actor.GetProperty().SetLineWidth(2)
|
||||
actor.GetProperty().EdgeVisibilityOff()
|
||||
self._offset_overlay_actor_toward_camera(actor, scale=0.00035)
|
||||
self.highlight_actor = actor
|
||||
self.highlight_signature = signature
|
||||
@@ -2930,11 +2949,13 @@ class WindowCoreMixin:
|
||||
face_ids = [index for index, solid_id in enumerate(self.model.face_solid_ids) if solid_id == target_id]
|
||||
self._highlight_hover_faces(face_ids=face_ids)
|
||||
elif kind == "feature":
|
||||
self._highlight_hover_faces(face_ids=[target_id])
|
||||
face_ids = self._selection_same_domain_face_ids(target_id) or [target_id]
|
||||
self._highlight_hover_faces(face_ids=face_ids)
|
||||
elif kind == "edge":
|
||||
self._highlight_hover_edge(target_id)
|
||||
else:
|
||||
self._highlight_hover_faces(face_ids=[target_id])
|
||||
face_ids = self._selection_same_domain_face_ids(target_id) or [target_id]
|
||||
self._highlight_hover_faces(face_ids=face_ids)
|
||||
self.hover_signature = signature
|
||||
self.render_window.Render()
|
||||
|
||||
@@ -2957,6 +2978,7 @@ class WindowCoreMixin:
|
||||
actor.GetProperty().SetInterpolationToPhong()
|
||||
actor.GetProperty().LightingOff()
|
||||
actor.GetProperty().SetLineWidth(2)
|
||||
actor.GetProperty().EdgeVisibilityOff()
|
||||
self._offset_overlay_actor_toward_camera(actor, scale=0.00055)
|
||||
self.hover_face_actor = actor
|
||||
self.renderer.AddActor(actor)
|
||||
|
||||
Reference in New Issue
Block a user