From a92014a36d4759efe20f227c82ddaf665330eec2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 7 Dec 2018 13:13:08 +0100 Subject: [PATCH] rework mesh segmentation dialog --- src/Mod/Mesh/App/Core/Segmentation.h | 8 +- src/Mod/Mesh/Gui/Segmentation.cpp | 20 +++- src/Mod/Mesh/Gui/Segmentation.ui | 142 +++++++++++++++++++++------ 3 files changed, 133 insertions(+), 37 deletions(-) diff --git a/src/Mod/Mesh/App/Core/Segmentation.h b/src/Mod/Mesh/App/Core/Segmentation.h index 9416028b69..6a6fadc436 100644 --- a/src/Mod/Mesh/App/Core/Segmentation.h +++ b/src/Mod/Mesh/App/Core/Segmentation.h @@ -110,8 +110,8 @@ class MeshExport MeshCurvatureCylindricalSegment : public MeshCurvatureSurfaceSe { public: MeshCurvatureCylindricalSegment(const std::vector& ci, unsigned long minFacets, - float tolMin, float tolMax, float radius) - : MeshCurvatureSurfaceSegment(ci, minFacets), toleranceMin(tolMin), toleranceMax(tolMax) { curvature = 1/radius;} + float tolMin, float tolMax, float curv) + : MeshCurvatureSurfaceSegment(ci, minFacets), toleranceMin(tolMin), toleranceMax(tolMax) { curvature = curv;} virtual bool TestFacet (const MeshFacet &rclFacet) const; virtual const char* GetType() const { return "Cylinder"; } @@ -124,8 +124,8 @@ private: class MeshExport MeshCurvatureSphericalSegment : public MeshCurvatureSurfaceSegment { public: - MeshCurvatureSphericalSegment(const std::vector& ci, unsigned long minFacets, float tol, float radius) - : MeshCurvatureSurfaceSegment(ci, minFacets), tolerance(tol) { curvature = 1/radius;} + MeshCurvatureSphericalSegment(const std::vector& ci, unsigned long minFacets, float tol, float curv) + : MeshCurvatureSurfaceSegment(ci, minFacets), tolerance(tol) { curvature = curv;} virtual bool TestFacet (const MeshFacet &rclFacet) const; virtual const char* GetType() const { return "Sphere"; } diff --git a/src/Mod/Mesh/Gui/Segmentation.cpp b/src/Mod/Mesh/Gui/Segmentation.cpp index 497202ebcd..3fe27d7975 100644 --- a/src/Mod/Mesh/Gui/Segmentation.cpp +++ b/src/Mod/Mesh/Gui/Segmentation.cpp @@ -48,12 +48,18 @@ Segmentation::Segmentation(Mesh::Feature* mesh, QWidget* parent, Qt::WindowFlags ui->setupUi(this); ui->numPln->setRange(1, INT_MAX); ui->numPln->setValue(100); - ui->radCyl->setRange(0, INT_MAX); + ui->crvCyl->setRange(0, INT_MAX); ui->numCyl->setRange(1, INT_MAX); ui->numCyl->setValue(100); - ui->radSph->setRange(0, INT_MAX); + ui->crvSph->setRange(0, INT_MAX); ui->numSph->setRange(1, INT_MAX); ui->numSph->setValue(100); + ui->crv1Free->setRange(-INT_MAX, INT_MAX); + ui->crv2Free->setRange(-INT_MAX, INT_MAX); + ui->numFree->setRange(1, INT_MAX); + ui->numFree->setValue(100); + + ui->checkBoxSmooth->setChecked(false); } Segmentation::~Segmentation() @@ -78,13 +84,19 @@ void Segmentation::accept() meshCurv.ComputePerVertex(); std::vector segm; + if (ui->groupBoxFree->isChecked()) { + segm.push_back(new MeshCore::MeshCurvatureFreeformSegment + (meshCurv.GetCurvature(), ui->numFree->value(), + ui->tol1Free->value(), ui->tol2Free->value(), + ui->crv1Free->value(), ui->crv2Free->value())); + } if (ui->groupBoxCyl->isChecked()) { segm.push_back(new MeshCore::MeshCurvatureCylindricalSegment - (meshCurv.GetCurvature(), ui->numCyl->value(), ui->tol1Cyl->value(), ui->tol2Cyl->value(), ui->radCyl->value().getValue())); + (meshCurv.GetCurvature(), ui->numCyl->value(), ui->tol1Cyl->value(), ui->tol2Cyl->value(), ui->crvCyl->value())); } if (ui->groupBoxSph->isChecked()) { segm.push_back(new MeshCore::MeshCurvatureSphericalSegment - (meshCurv.GetCurvature(), ui->numSph->value(), ui->tolSph->value(), ui->radSph->value().getValue())); + (meshCurv.GetCurvature(), ui->numSph->value(), ui->tolSph->value(), ui->crvSph->value())); } if (ui->groupBoxPln->isChecked()) { segm.push_back(new MeshCore::MeshCurvaturePlanarSegment diff --git a/src/Mod/Mesh/Gui/Segmentation.ui b/src/Mod/Mesh/Gui/Segmentation.ui index 8336a64f08..fe4455f7a6 100644 --- a/src/Mod/Mesh/Gui/Segmentation.ui +++ b/src/Mod/Mesh/Gui/Segmentation.ui @@ -50,10 +50,10 @@ - 0.100000000000000 + 0.010000000000000 - 0.100000000000000 + 0.010000000000000 @@ -89,20 +89,17 @@ - Radius + Curvature - - - mm - + - 0.100000000000000 + 0.010000000000000 - 5.000000000000000 + 0.200000000000000 @@ -116,10 +113,10 @@ - 0.100000000000000 + 0.010000000000000 - 0.100000000000000 + 0.010000000000000 @@ -133,10 +130,10 @@ - 0.100000000000000 + 0.010000000000000 - 0.100000000000000 + 0.010000000000000 @@ -172,20 +169,17 @@ - Radius + Curvature - - - mm - + - 0.100000000000000 + 0.010000000000000 - 5.000000000000000 + 0.200000000000000 @@ -199,10 +193,10 @@ - 0.100000000000000 + 0.010000000000000 - 0.100000000000000 + 0.010000000000000 @@ -226,15 +220,105 @@ + + + + Freeform + + + true + + + + + + Max. Curvature + + + + + + + 0.010000000000000 + + + 0.200000000000000 + + + + + + + Tolerance + + + + + + + 0.010000000000000 + + + 0.010000000000000 + + + + + + + Min. Curvature + + + + + + + 0.010000000000000 + + + 0.200000000000000 + + + + + + + Tolerance + + + + + + + 0.010000000000000 + + + 0.010000000000000 + + + + + + + Minimum number of faces + + + + + + + 100000 + + + 100 + + + + + + - - - Gui::QuantitySpinBox - QWidget -
Gui/QuantitySpinBox.h
-
-