parent
05bc4d13e1
commit
db13fbb7b3
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<width>539</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -53,20 +53,7 @@
|
|||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" rowspan="2" colspan="2">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="toolTip">
|
||||
<string>Defines the deviation of tessellation to the actual surface</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Maximum deviation depending on the model bounding box</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="maxDeviation">
|
||||
<property name="suffix">
|
||||
<string> %</string>
|
||||
|
@ -94,6 +81,54 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="toolTip">
|
||||
<string>Defines the deviation of tessellation to the actual surface</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Maximum deviation depending on the model bounding box</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Maximum angular deflection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="maxAngularDeflection">
|
||||
<property name="suffix">
|
||||
<string> °</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.0</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>180.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.5</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>28.5</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>MeshAngularDeflection</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Part</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -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<App::Document*> docs = App::GetApplication().getDocuments();
|
||||
|
@ -85,6 +86,7 @@ void DlgSettings3DViewPart::saveSettings()
|
|||
void DlgSettings3DViewPart::loadSettings()
|
||||
{
|
||||
ui->maxDeviation->onRestore();
|
||||
ui->maxAngularDeflection->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -124,6 +124,7 @@ protected:
|
|||
private:
|
||||
// settings stuff
|
||||
float meshDeviation;
|
||||
float angularDeflection;
|
||||
bool noPerVertexNormals;
|
||||
bool qualityNormals;
|
||||
static App::PropertyFloatConstraint::Constraints floatRange;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <Standard_math.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <App/PropertyUnits.h>
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
#include <map>
|
||||
|
||||
|
@ -71,6 +72,7 @@ public:
|
|||
App::PropertyFloatConstraint LineWidth;
|
||||
App::PropertyFloatConstraint PointSize;
|
||||
App::PropertyFloatConstraint Deviation;
|
||||
App::PropertyAngle AngularDeflection;
|
||||
App::PropertyColor LineColor;
|
||||
App::PropertyColor PointColor;
|
||||
App::PropertyMaterial LineMaterial;
|
||||
|
@ -143,6 +145,7 @@ private:
|
|||
bool qualityNormals;
|
||||
static App::PropertyFloatConstraint::Constraints sizeRange;
|
||||
static App::PropertyFloatConstraint::Constraints tessRange;
|
||||
static App::PropertyQuantityConstraint::Constraints angDeflectionRange;
|
||||
static const char* LightingEnums[];
|
||||
static const char* DrawStyleEnums[];
|
||||
};
|
||||
|
|
|
@ -247,9 +247,15 @@ void ViewProviderTransformed::recomputeFeature(void)
|
|||
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
|
||||
BRepMesh_IncrementalMesh myMesh(cShape,deflection);
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
BRepMesh_IncrementalMesh(cShape,deflection,Standard_False,
|
||||
AngDeflectionRads,Standard_True);
|
||||
#else
|
||||
BRepMesh_IncrementalMesh(cShape,deflection);
|
||||
#endif
|
||||
// We must reset the location here because the transformation data
|
||||
// are set in the placement property
|
||||
TopLoc_Location aLoc;
|
||||
|
|
Loading…
Reference in New Issue
Block a user