diff --git a/src/Mod/Part/Gui/DlgSettings3DViewPart.ui b/src/Mod/Part/Gui/DlgSettings3DViewPart.ui
index 8b8a4c6526..96b2580eb2 100644
--- a/src/Mod/Part/Gui/DlgSettings3DViewPart.ui
+++ b/src/Mod/Part/Gui/DlgSettings3DViewPart.ui
@@ -6,7 +6,7 @@
0
0
- 525
+ 539
339
@@ -53,20 +53,7 @@
6
- -
-
-
- Defines the deviation of tessellation to the actual surface
-
-
- <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:7.8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Tessellation</span></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><span style=" font-weight:400;">Defines the maximum deviation of the tessellated mesh to the surface. The smaller the value is the slower the render speed and the nicer the appearance are.</span></p></body></html>
-
-
- Maximum deviation depending on the model bounding box
-
-
-
- -
+
-
%
@@ -94,6 +81,54 @@
+ -
+
+
+ Defines the deviation of tessellation to the actual surface
+
+
+ <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg 2; font-size:7.8pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Tessellation</span></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><span style=" font-weight:400;">Defines the maximum deviation of the tessellated mesh to the surface. The smaller the value is the slower the render speed and the nicer the appearance are.</span></p></body></html>
+
+
+ Maximum deviation depending on the model bounding box
+
+
+
+ -
+
+
+ Maximum angular deflection
+
+
+
+ -
+
+
+ °
+
+
+ 2
+
+
+ 0.0
+
+
+ 180.000000000000000
+
+
+ 0.5
+
+
+ 28.5
+
+
+ MeshAngularDeflection
+
+
+ Mod/Part
+
+
+
diff --git a/src/Mod/Part/Gui/DlgSettings3DViewPartImp.cpp b/src/Mod/Part/Gui/DlgSettings3DViewPartImp.cpp
index 846775ce34..479875500a 100644
--- a/src/Mod/Part/Gui/DlgSettings3DViewPartImp.cpp
+++ b/src/Mod/Part/Gui/DlgSettings3DViewPartImp.cpp
@@ -70,6 +70,7 @@ void DlgSettings3DViewPart::on_maxDeviation_valueChanged(double v)
void DlgSettings3DViewPart::saveSettings()
{
ui->maxDeviation->onSave();
+ ui->maxAngularDeflection->onSave();
// search for Part view providers and apply the new settings
std::vector docs = App::GetApplication().getDocuments();
@@ -85,6 +86,7 @@ void DlgSettings3DViewPart::saveSettings()
void DlgSettings3DViewPart::loadSettings()
{
ui->maxDeviation->onRestore();
+ ui->maxAngularDeflection->onRestore();
}
/**
diff --git a/src/Mod/Part/Gui/ViewProvider.cpp b/src/Mod/Part/Gui/ViewProvider.cpp
index b540442abb..421571ad58 100644
--- a/src/Mod/Part/Gui/ViewProvider.cpp
+++ b/src/Mod/Part/Gui/ViewProvider.cpp
@@ -422,6 +422,7 @@ bool ViewProviderPartBase::loadParameter()
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Mod/Part");
float deviation = hGrp->GetFloat("MeshDeviation",0.2);
+ float angularDeflection = hGrp->GetFloat("MeshAngularDeflection",28.65);
bool novertexnormals = hGrp->GetBool("NoPerVertexNormals",false);
bool qualitynormals = hGrp->GetBool("QualityNormals",false);
@@ -429,6 +430,9 @@ bool ViewProviderPartBase::loadParameter()
this->meshDeviation = deviation;
changed = true;
}
+ if (this->angularDeflection != angularDeflection) {
+ this->angularDeflection = angularDeflection;
+ }
if (this->noPerVertexNormals != novertexnormals) {
this->noPerVertexNormals = novertexnormals;
changed = true;
@@ -472,8 +476,14 @@ void ViewProviderPartBase::updateData(const App::Property* prop)
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 *
this->meshDeviation;
+ Standard_Real AngDeflectionRads = this-> angularDeflection / 180.0 * M_PI;
+#if OCC_VERSION_HEX >= 0x060600
+ BRepMesh_IncrementalMesh(cShape,deflection,Standard_False,
+ AngDeflectionRads,Standard_True);
+#else
BRepMesh_IncrementalMesh(cShape,deflection);
+#endif
//BRepMesh_IncrementalMesh MESH(cShape,meshDeviation);
// We must reset the location here because the transformation data
// are set in the placement property
diff --git a/src/Mod/Part/Gui/ViewProvider.h b/src/Mod/Part/Gui/ViewProvider.h
index 56e2389fb7..ad3db83feb 100644
--- a/src/Mod/Part/Gui/ViewProvider.h
+++ b/src/Mod/Part/Gui/ViewProvider.h
@@ -124,6 +124,7 @@ protected:
private:
// settings stuff
float meshDeviation;
+ float angularDeflection;
bool noPerVertexNormals;
bool qualityNormals;
static App::PropertyFloatConstraint::Constraints floatRange;
diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp
index 02ad4c6457..3cc46fcd1c 100644
--- a/src/Mod/Part/Gui/ViewProviderExt.cpp
+++ b/src/Mod/Part/Gui/ViewProviderExt.cpp
@@ -220,6 +220,7 @@ void GetNormals(const TopoDS_Face& theFace,
App::PropertyFloatConstraint::Constraints ViewProviderPartExt::sizeRange = {1.0,64.0,1.0};
App::PropertyFloatConstraint::Constraints ViewProviderPartExt::tessRange = {0.0001,100.0,0.01};
+App::PropertyQuantityConstraint::Constraints ViewProviderPartExt::angDeflectionRange = {0.0,180.0,0.05};
const char* ViewProviderPartExt::LightingEnums[]= {"One side","Two side",NULL};
const char* ViewProviderPartExt::DrawStyleEnums[]= {"Solid","Dashed","Dotted","Dashdot",NULL};
@@ -250,6 +251,8 @@ ViewProviderPartExt::ViewProviderPartExt()
ADD_PROPERTY(PointSize,(lwidth));
ADD_PROPERTY(Deviation,(0.5f));
Deviation.setConstraints(&tessRange);
+ ADD_PROPERTY(AngularDeflection,(28.65));
+ AngularDeflection.setConstraints(&angDeflectionRange);
ADD_PROPERTY(Lighting,(1));
Lighting.setEnums(LightingEnums);
ADD_PROPERTY(DrawStyle,((long int)0));
@@ -321,6 +324,9 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
if (prop == &Deviation) {
VisualTouched = true;
}
+ if (prop == &AngularDeflection) {
+ VisualTouched = true;
+ }
if (prop == &LineWidth) {
pcLineStyle->lineWidth = LineWidth.getValue();
}
@@ -632,6 +638,7 @@ bool ViewProviderPartExt::loadParameter()
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/Mod/Part");
float deviation = hGrp->GetFloat("MeshDeviation",0.2);
+ float angularDeflection = hGrp->GetFloat("MeshAngularDeflection",28.65);
bool novertexnormals = hGrp->GetBool("NoPerVertexNormals",false);
bool qualitynormals = hGrp->GetBool("QualityNormals",false);
@@ -639,6 +646,9 @@ bool ViewProviderPartExt::loadParameter()
Deviation.setValue(deviation);
changed = true;
}
+ if (AngularDeflection.getValue() != angularDeflection ) {
+ AngularDeflection.setValue(angularDeflection);
+ }
if (this->noPerVertexNormals != novertexnormals) {
this->noPerVertexNormals = novertexnormals;
changed = true;
@@ -752,12 +762,14 @@ void ViewProviderPartExt::updateVisual(const TopoDS_Shape& inputShape)
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 *
Deviation.getValue();
+ Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
// create or use the mesh on the data structure
#if OCC_VERSION_HEX >= 0x060600
- BRepMesh_IncrementalMesh myMesh(cShape,deflection,Standard_False,0.5,Standard_True);
+ BRepMesh_IncrementalMesh(cShape,deflection,Standard_False,
+ AngDeflectionRads,Standard_True);
#else
- BRepMesh_IncrementalMesh myMesh(cShape,deflection);
+ BRepMesh_IncrementalMesh(cShape,deflection);
#endif
// We must reset the location here because the transformation data
// are set in the placement property
diff --git a/src/Mod/Part/Gui/ViewProviderExt.h b/src/Mod/Part/Gui/ViewProviderExt.h
index c9e2fd00b4..2167c252ef 100644
--- a/src/Mod/Part/Gui/ViewProviderExt.h
+++ b/src/Mod/Part/Gui/ViewProviderExt.h
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include