feat: 完善 Face 一级关系编辑和稳定性

This commit is contained in:
2026-08-04 09:35:39 +08:00
parent bb44e3920d
commit 5799d5d813
29 changed files with 6295 additions and 189 deletions
+20 -1
View File
@@ -140,7 +140,26 @@ class PolydataMixin:
def _ensure_mesh(self, deflection: float) -> None:
requested = max(float(deflection), 1e-9)
if self._mesh_deflection is None or requested < self._mesh_deflection * 0.999:
BRepMesh_IncrementalMesh(self.shape, requested)
if requested <= 0.04:
BRepMesh_IncrementalMesh(
self.shape,
0.35,
False,
math.radians(12.0),
True,
)
for face in self.faces:
try:
surface_type = BRepAdaptor_Surface(face).GetType()
if surface_type in {GeomAbs_Cylinder, GeomAbs_Cone}:
BRepMesh_IncrementalMesh(face, requested, False, math.radians(1.2), True)
elif surface_type in {GeomAbs_Sphere, GeomAbs_Torus}:
BRepMesh_IncrementalMesh(face, max(requested, 0.1), False, math.radians(4.0), True)
except Exception:
continue
else:
angular_degrees = min(24.0, max(12.0, 12.0 * requested / 0.35))
BRepMesh_IncrementalMesh(self.shape, requested, False, math.radians(angular_degrees), True)
self._mesh_deflection = requested
def build_snapshot_polydata(self, snapshot: dict[object, object], deflection: float = 0.8):