feat: 完善 Face 一级关系编辑和稳定性
This commit is contained in:
@@ -120,9 +120,11 @@ class TransformMixin:
|
||||
part = self.part_by_id(part_id)
|
||||
if part is None:
|
||||
raise ValueError(f"未知零件 ID {part_id}")
|
||||
previous_logical_ids = tuple(getattr(self, "face_logical_ids", ()))
|
||||
part.shape = _translated_shape_by_vector(part.shape, vector)
|
||||
_ensure_valid_shape(part.shape)
|
||||
self.refresh_topology()
|
||||
self._restore_face_logical_ids_if_count_matches(previous_logical_ids)
|
||||
return (
|
||||
f"零件已平移: 零件 {part_id}, vector={_format_tuple(vector)}, "
|
||||
f"distance={float(plan['translation_distance']):g}, risk={plan['risk']}."
|
||||
@@ -137,6 +139,7 @@ class TransformMixin:
|
||||
if part is None:
|
||||
raise ValueError(f"Unknown part id {part_id}")
|
||||
|
||||
previous_logical_ids = tuple(getattr(self, "face_logical_ids", ()))
|
||||
part_solids = _explore(part.shape, TopAbs_SOLID)
|
||||
if len(part_solids) <= 1:
|
||||
part.shape = _translated_shape_by_vector(part.shape, vector)
|
||||
@@ -156,6 +159,7 @@ class TransformMixin:
|
||||
|
||||
_ensure_valid_shape(part.shape)
|
||||
self.refresh_topology()
|
||||
self._restore_face_logical_ids_if_count_matches(previous_logical_ids)
|
||||
return (
|
||||
f"Solid translated: solid {solid_id}, part {part_id}, vector={_format_tuple(vector)}, "
|
||||
f"distance={float(plan['translation_distance']):g}, risk={plan['risk']}."
|
||||
|
||||
Reference in New Issue
Block a user