From e3e22f83c5ecfa238210efc7f0eb6a0a195534c9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 10 Dec 2021 13:31:40 +0100 Subject: [PATCH] Part: a deflection of 0.0 is not allowed any more for meshing a shape --- src/Mod/Part/Gui/ViewProviderExt.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 8fb9c9fe0d..0bb3ee76d8 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -971,16 +971,19 @@ void ViewProviderPartExt::updateVisual() bounds.SetGap(0.0); Standard_Real xMin, yMin, zMin, xMax, yMax, zMax; bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); - Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * - Deviation.getValue(); + Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 * Deviation.getValue(); + + // Since OCCT 7.6 a value of equal 0 is not allowed any more, this can happen if a single vertex + // should be displayed. + if (deflection < gp::Resolution()) + deflection = Precision::Confusion(); // create or use the mesh on the data structure #if OCC_VERSION_HEX >= 0x060600 Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI; - BRepMesh_IncrementalMesh(cShape,deflection,Standard_False, - AngDeflectionRads,Standard_True); + BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True); #else - BRepMesh_IncrementalMesh(cShape,deflection); + BRepMesh_IncrementalMesh(cShape, deflection); #endif // We must reset the location here because the transformation data // are set in the placement property @@ -1291,6 +1294,10 @@ void ViewProviderPartExt::updateVisual() faceset ->partIndex .finishEditing(); lineset ->coordIndex .finishEditing(); } + catch (const Standard_Failure& e) { + FC_ERR("Cannot compute Inventor representation for the shape of " + << pcObject->getFullName() << ": " << e.GetMessageString()); + } catch (...) { FC_ERR("Cannot compute Inventor representation for the shape of " << pcObject->getFullName()); }