From cf9ed2b070d8172933e03445fa65dd0431d19d5b Mon Sep 17 00:00:00 2001 From: bdieterm <119257544+bdieterm@users.noreply.github.com> Date: Sun, 23 Jul 2023 10:10:16 +0200 Subject: [PATCH] Part: allow reduction of Part ViewProvider tesselation resolution Problem description To display a shape, the ViewProvider creates a mesh of the shape data. The resolution depends also on the two parameters "Angular Deflection" and "Deviation" in the View properties. (The values of these parameters are also updated for all objects when changing these settings in the Preferences dialog). Changing the parameters from a high value to a lower value has an immediate effect on the displayed shape -- for example a circle will be displayed finer with more line segments. But changing the parameter back to the higher value (with less resolution) will keep the finer view-mesh instead of calculating a coarser one. To get back to the coarse view, the object has to be manually recomputed or the file re-opened. Solution I just set the meshing parameter AllowQualityDecrease to True. I guess that this was not implemented before because this parameter is quite new (introduced in OCC v7.5 in the year 2020). --- src/Mod/Part/Gui/ViewProviderExt.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index e152df7e99..554f7a405a 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -951,7 +951,19 @@ void ViewProviderPartExt::updateVisual() // create or use the mesh on the data structure Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI; + +#if OCC_VERSION_HEX >= 0x070500 + IMeshTools_Parameters meshParams; + meshParams.Deflection = deflection; + meshParams.Relative = Standard_False; + meshParams.Angle = AngDeflectionRads; + meshParams.InParallel = Standard_True; + meshParams.AllowQualityDecrease = Standard_True; + + BRepMesh_IncrementalMesh(cShape, meshParams); +#else BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True); +#endif // We must reset the location here because the transformation data // are set in the placement property