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).
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user