+ add task dialog to perform B-Spline fit
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
|
||||
#include <CXX/Extensions.hxx>
|
||||
#include <CXX/Objects.hxx>
|
||||
@@ -76,6 +77,7 @@ private:
|
||||
Py::Object approxSurface(const Py::Tuple& args, const Py::Dict& kwds)
|
||||
{
|
||||
PyObject *o;
|
||||
PyObject *uvdirs = 0;
|
||||
// spline parameters
|
||||
int uDegree = 3;
|
||||
int vDegree = 3;
|
||||
@@ -86,21 +88,22 @@ private:
|
||||
double weight = 0.1;
|
||||
double grad = 1.0; //0.5
|
||||
double bend = 0.0; //0.2
|
||||
double curv = 0.0; //0.3
|
||||
// other parameters
|
||||
int iteration = 5;
|
||||
PyObject* correction = Py_True;
|
||||
double factor = 1.0;
|
||||
|
||||
static char* kwds_approx[] = {"Points", "UDegree", "VDegree", "NbUPoles", "NbVPoles",
|
||||
"Smooth", "Weight", "Grad", "Bend",
|
||||
"Iterations", "Correction", "PatchFactor", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O|iiiiO!dddiO!d",kwds_approx,
|
||||
"Smooth", "Weight", "Grad", "Bend", "Curv",
|
||||
"Iterations", "Correction", "PatchFactor","UVDirs", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O|iiiiO!ddddiO!dO!",kwds_approx,
|
||||
&o,&uDegree,&vDegree,&uPoles,&vPoles,
|
||||
&PyBool_Type,&smooth,&weight,&grad,&bend,
|
||||
&iteration,&PyBool_Type,&correction,&factor))
|
||||
&PyBool_Type,&smooth,&weight,&grad,&bend,&curv,
|
||||
&iteration,&PyBool_Type,&correction,&factor,
|
||||
&PyTuple_Type,&uvdirs))
|
||||
throw Py::Exception();
|
||||
|
||||
double curvdiv = 1.0 - (grad + bend);
|
||||
int uOrder = uDegree + 1;
|
||||
int vOrder = vDegree + 1;
|
||||
|
||||
@@ -111,8 +114,8 @@ private:
|
||||
if (bend < 0.0 || bend > 1.0) {
|
||||
throw Py::ValueError("Value of Bend out of range [0,1]");
|
||||
}
|
||||
if (curvdiv < 0.0 || curvdiv > 1.0) {
|
||||
throw Py::ValueError("Sum of Grad and Bend out of range [0,1]");
|
||||
if (curv < 0.0 || curv > 1.0) {
|
||||
throw Py::ValueError("Value of Curv out of range [0,1]");
|
||||
}
|
||||
if (uDegree < 1 || uOrder > uPoles) {
|
||||
throw Py::ValueError("Value of uDegree out of range [1,NbUPoles-1]");
|
||||
@@ -121,6 +124,10 @@ private:
|
||||
throw Py::ValueError("Value of vDegree out of range [1,NbVPoles-1]");
|
||||
}
|
||||
|
||||
double sum = (grad + bend + curv);
|
||||
if (sum > 0)
|
||||
weight = weight / sum;
|
||||
|
||||
try {
|
||||
std::vector<Base::Vector3f> pts;
|
||||
if (PyObject_TypeCheck(o, &(Points::PointsPy::Type))) {
|
||||
@@ -154,7 +161,13 @@ private:
|
||||
Reen::BSplineParameterCorrection pc(uOrder,vOrder,uPoles,vPoles);
|
||||
Handle_Geom_BSplineSurface hSurf;
|
||||
|
||||
pc.EnableSmoothing(PyObject_IsTrue(smooth) ? true : false, weight, grad, bend, curvdiv);
|
||||
if (uvdirs) {
|
||||
Py::Tuple t(uvdirs);
|
||||
Base::Vector3d u = Py::Vector(t.getItem(0)).toVector();
|
||||
Base::Vector3d v = Py::Vector(t.getItem(1)).toVector();
|
||||
pc.SetUV(u, v);
|
||||
}
|
||||
pc.EnableSmoothing(PyObject_IsTrue(smooth) ? true : false, weight, grad, bend, curv);
|
||||
hSurf = pc.CreateSurface(clPoints, iteration, PyObject_IsTrue(correction) ? true : false, factor);
|
||||
if (!hSurf.IsNull()) {
|
||||
return Py::asObject(new Part::BSplineSurfacePy(new Part::GeomBSplineSurface(hSurf)));
|
||||
|
||||
@@ -664,12 +664,14 @@ bool ParameterCorrection::GetUVParameters(double fSizeFactor)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParameterCorrection::SetUVW(const Base::Vector3d& clU, const Base::Vector3d& clV, const Base::Vector3d& clW, bool bUseDir)
|
||||
void ParameterCorrection::SetUV(const Base::Vector3d& clU, const Base::Vector3d& clV, bool bUseDir)
|
||||
{
|
||||
_clU = clU;
|
||||
_clV = clV;
|
||||
_clW = clW;
|
||||
_bGetUVDir = bUseDir;
|
||||
if (_bGetUVDir) {
|
||||
_clU = clU;
|
||||
_clW = clU % clV;
|
||||
_clV = _clW % _clU;
|
||||
}
|
||||
}
|
||||
|
||||
void ParameterCorrection::GetUVW(Base::Vector3d& clU, Base::Vector3d& clV, Base::Vector3d& clW) const
|
||||
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
* Setzen der u/v-Richtungen
|
||||
* Dritter Parameter gibt an, ob die Richtungen tatsaechlich verwendet werden sollen.
|
||||
*/
|
||||
virtual void SetUVW(const Base::Vector3d& clU, const Base::Vector3d& clV, const Base::Vector3d& clW, bool bUseDir=true);
|
||||
virtual void SetUV(const Base::Vector3d& clU, const Base::Vector3d& clV, bool bUseDir=true);
|
||||
|
||||
/**
|
||||
* Gibt die u/v/w-Richtungen zurueck
|
||||
@@ -347,7 +347,7 @@ protected:
|
||||
unsigned _usVCtrlpoints; //! Anzahl der Kontrollpunkte in v-Richtung
|
||||
Base::Vector3d _clU; //! u-Richtung
|
||||
Base::Vector3d _clV; //! v-Richtung
|
||||
Base::Vector3d _clW; //! w-Richtung (senkrecht zu u-und w-Richtung)
|
||||
Base::Vector3d _clW; //! w-Richtung (senkrecht zu u-und v-Richtung)
|
||||
TColgp_Array1OfPnt* _pvcPoints; //! Punktliste der Rohdaten
|
||||
TColgp_Array1OfPnt2d* _pvcUVParam; //! Parameterwerte zu den Punkten aus der Liste
|
||||
TColgp_Array2OfPnt _vCtrlPntsOfSurf; //! Array von Kontrollpunkten
|
||||
|
||||
@@ -25,8 +25,27 @@ set(ReenGui_LIBS
|
||||
|
||||
qt4_add_resources(ReenGui_QRC_SRCS Resources/ReverseEngineering.qrc)
|
||||
|
||||
set(ReenGui_MOC_HDRS
|
||||
FitBSplineSurface.h
|
||||
)
|
||||
fc_wrap_cpp(ReenGui_MOC_SRCS ${ReenGui_MOC_HDRS})
|
||||
SOURCE_GROUP("Moc" FILES ${ReenGui_MOC_SRCS})
|
||||
|
||||
set(Dialogs_UIC_SRCS
|
||||
FitBSplineSurface.ui
|
||||
)
|
||||
qt4_wrap_ui(Dialogs_UIC_HDRS ${Dialogs_UIC_SRCS})
|
||||
SET(Dialogs_SRCS
|
||||
${Dialogs_UIC_HDRS}
|
||||
${Dialogs_UIC_SRCS}
|
||||
FitBSplineSurface.cpp
|
||||
FitBSplineSurface.h
|
||||
)
|
||||
SOURCE_GROUP("Dialogs" FILES ${Dialogs_SRCS})
|
||||
|
||||
SET(ReenGui_SRCS
|
||||
${ReenGui_QRC_SRCS}
|
||||
${Dialogs_SRCS}
|
||||
AppReverseEngineeringGui.cpp
|
||||
Command.cpp
|
||||
Resources/ReverseEngineering.qrc
|
||||
|
||||
@@ -23,23 +23,28 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QApplication>
|
||||
# include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Points/App/PointsFeature.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
#include <Mod/Mesh/App/Core/Approximation.h>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/FileDialog.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Base/CoordinateSystem.h>
|
||||
|
||||
#include "../App/ApproxSurface.h"
|
||||
#include "FitBSplineSurface.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -50,7 +55,7 @@ CmdApproxSurface::CmdApproxSurface()
|
||||
{
|
||||
sAppModule = "Reen";
|
||||
sGroup = QT_TR_NOOP("Reverse Engineering");
|
||||
sMenuText = QT_TR_NOOP("Approximate surface...");
|
||||
sMenuText = QT_TR_NOOP("Approximate B-Spline surface...");
|
||||
sToolTipText = QT_TR_NOOP("Approximate a B-Spline surface");
|
||||
sWhatsThis = "Reen_ApproxSurface";
|
||||
sStatusTip = sToolTipText;
|
||||
@@ -59,48 +64,23 @@ CmdApproxSurface::CmdApproxSurface()
|
||||
|
||||
void CmdApproxSurface::activated(int iMsg)
|
||||
{
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
const Mesh::MeshObject& mesh = static_cast<Mesh::Feature*>(obj[0])->Mesh.getValue();
|
||||
if (mesh.countSegments() > 0) {
|
||||
const Mesh::Segment& segm = mesh.getSegment(0);
|
||||
const std::vector<unsigned long>& inds = segm.getIndices();
|
||||
MeshCore::MeshFacetIterator f_iter(mesh.getKernel());
|
||||
std::set<unsigned long> points;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
f_iter.Set(*it);
|
||||
MeshCore::MeshFacet face = f_iter.GetIndices();
|
||||
points.insert(face._aulPoints[0]);
|
||||
points.insert(face._aulPoints[1]);
|
||||
points.insert(face._aulPoints[2]);
|
||||
}
|
||||
|
||||
std::stringstream str;
|
||||
str << "__points=[]" << std::endl;
|
||||
for (std::set<unsigned long>::iterator it=points.begin(); it != points.end(); ++it) {
|
||||
Mesh::MeshPoint p = mesh.getPoint(*it);
|
||||
str << "__points.append((" << p.x << "," << p.y << "," << p.z << "))" << std::endl;
|
||||
}
|
||||
|
||||
str << "import ReverseEngineering" << std::endl;
|
||||
str << "__spline = ReverseEngineering.approxSurface(__points)" << std::endl;
|
||||
str << "App.ActiveDocument.addObject(\"Part::Feature\",\"Surface\").Shape"
|
||||
"=__spline.toShape(0.0,1.0,0.0,1.0)" << std::endl;
|
||||
str << "App.ActiveDocument.recompute()" << std::endl;
|
||||
str << "del __points" << std::endl;
|
||||
str << "del __spline" << std::endl;
|
||||
|
||||
openCommand("Fit surface");
|
||||
doCommand(Gui::Command::Doc, str.str().c_str());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
App::DocumentObjectT objT;
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(Points::Feature::getClassTypeId());
|
||||
if (obj.size() != 1) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ApproxSurface", "Wrong selection"),
|
||||
qApp->translate("Reen_ApproxSurface", "Please select a single point cloud.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
objT = obj.front();
|
||||
Gui::Control().showDialog(new ReenGui::TaskFitBSplineSurface(objT));
|
||||
}
|
||||
|
||||
bool CmdApproxSurface::isActive(void)
|
||||
{
|
||||
if (getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) == 1)
|
||||
return true;
|
||||
return false;
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
DEF_STD_CMD_A(CmdApproxPlane);
|
||||
|
||||
201
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp
Normal file
201
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp
Normal file
@@ -0,0 +1,201 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2015 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
# include <QTextStream>
|
||||
#endif
|
||||
|
||||
#include "ui_FitBSplineSurface.h"
|
||||
#include "FitBSplineSurface.h"
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Base/Interpreter.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
|
||||
|
||||
using namespace ReenGui;
|
||||
|
||||
class FitBSplineSurfaceWidget::Private
|
||||
{
|
||||
public:
|
||||
Ui_FitBSplineSurface ui;
|
||||
App::DocumentObjectT obj;
|
||||
Private()
|
||||
{
|
||||
}
|
||||
~Private()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* TRANSLATOR ReenGui::FitBSplineSurfaceWidget */
|
||||
|
||||
FitBSplineSurfaceWidget::FitBSplineSurfaceWidget(const App::DocumentObjectT& obj, QWidget* parent)
|
||||
: d(new Private())
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
d->ui.uvdir->setDisabled(true);
|
||||
d->obj = obj;
|
||||
restoreSettings();
|
||||
}
|
||||
|
||||
FitBSplineSurfaceWidget::~FitBSplineSurfaceWidget()
|
||||
{
|
||||
saveSettings();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void FitBSplineSurfaceWidget::restoreSettings()
|
||||
{
|
||||
d->ui.degreeU->onRestore();
|
||||
d->ui.polesU->onRestore();
|
||||
d->ui.degreeV->onRestore();
|
||||
d->ui.polesV->onRestore();
|
||||
d->ui.iterations->onRestore();
|
||||
d->ui.sizeFactor->onRestore();
|
||||
d->ui.totalWeight->onRestore();
|
||||
d->ui.gradient->onRestore();
|
||||
d->ui.bending->onRestore();
|
||||
d->ui.curvature->onRestore();
|
||||
d->ui.uvdir->onRestore();
|
||||
}
|
||||
|
||||
void FitBSplineSurfaceWidget::saveSettings()
|
||||
{
|
||||
d->ui.degreeU->onSave();
|
||||
d->ui.polesU->onSave();
|
||||
d->ui.degreeV->onSave();
|
||||
d->ui.polesV->onSave();
|
||||
d->ui.iterations->onSave();
|
||||
d->ui.sizeFactor->onSave();
|
||||
d->ui.totalWeight->onSave();
|
||||
d->ui.gradient->onSave();
|
||||
d->ui.bending->onSave();
|
||||
d->ui.curvature->onSave();
|
||||
d->ui.uvdir->onSave();
|
||||
}
|
||||
|
||||
bool FitBSplineSurfaceWidget::accept()
|
||||
{
|
||||
try {
|
||||
QString document = QString::fromStdString(d->obj.getDocumentPython());
|
||||
QString object = QString::fromStdString(d->obj.getObjectPython());
|
||||
|
||||
QString argument = QString::fromLatin1(
|
||||
"Points=%1.Points, "
|
||||
"UDegree=%2, VDegree=%3, "
|
||||
"NbUPoles=%4, NbVPoles=%5, "
|
||||
"Smooth=%6, "
|
||||
"Weight=%7, "
|
||||
"Grad=%8, "
|
||||
"Bend=%9, "
|
||||
"Curv=%10, "
|
||||
"Iterations=%11, "
|
||||
"PatchFactor=%12, "
|
||||
"Correction=True"
|
||||
)
|
||||
.arg(object)
|
||||
.arg(d->ui.degreeU->value())
|
||||
.arg(d->ui.degreeV->value())
|
||||
.arg(d->ui.polesU->value())
|
||||
.arg(d->ui.polesV->value())
|
||||
.arg(d->ui.groupBoxSmooth->isChecked() ? QLatin1String("True") : QLatin1String("False"))
|
||||
.arg(d->ui.totalWeight->value())
|
||||
.arg(d->ui.gradient->value())
|
||||
.arg(d->ui.bending->value())
|
||||
.arg(d->ui.curvature->value())
|
||||
.arg(d->ui.iterations->value())
|
||||
.arg(d->ui.sizeFactor->value())
|
||||
;
|
||||
if (d->ui.uvdir->isChecked()) {
|
||||
// todo
|
||||
argument += QString::fromLatin1(", UVDirs=(FreeCAD.Vector(1,0,0), FreeCAD.Vector(0,1,0))");
|
||||
}
|
||||
QString command = QString::fromLatin1("%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
|
||||
"ReverseEngineering.approxSurface(%2).toShape()")
|
||||
.arg(document)
|
||||
.arg(argument)
|
||||
;
|
||||
|
||||
Gui::WaitCursor wc;
|
||||
Gui::Command::addModule(Gui::Command::App, "ReverseEngineering");
|
||||
Gui::Command::openCommand("Fit B-Spline");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, command.toLatin1());
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Gui::Command::abortCommand();
|
||||
QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FitBSplineSurfaceWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
d->ui.retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TRANSLATOR ReenGui::TaskFitBSplineSurface */
|
||||
|
||||
TaskFitBSplineSurface::TaskFitBSplineSurface(const App::DocumentObjectT& obj)
|
||||
{
|
||||
widget = new FitBSplineSurfaceWidget(obj);
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
Gui::BitmapFactory().pixmap("actions/FitSurface"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskFitBSplineSurface::~TaskFitBSplineSurface()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskFitBSplineSurface::open()
|
||||
{
|
||||
}
|
||||
|
||||
bool TaskFitBSplineSurface::accept()
|
||||
{
|
||||
return widget->accept();
|
||||
}
|
||||
|
||||
#include "moc_FitBSplineSurface.cpp"
|
||||
75
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.h
Normal file
75
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2015 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef REENGUI_FITBSPLINESURFACE_H
|
||||
#define REENGUI_FITBSPLINESURFACE_H
|
||||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
|
||||
namespace ReenGui {
|
||||
|
||||
class FitBSplineSurfaceWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FitBSplineSurfaceWidget(const App::DocumentObjectT&, QWidget* parent = 0);
|
||||
~FitBSplineSurfaceWidget();
|
||||
|
||||
bool accept();
|
||||
|
||||
private:
|
||||
void restoreSettings();
|
||||
void saveSettings();
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* d;
|
||||
};
|
||||
|
||||
class TaskFitBSplineSurface : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskFitBSplineSurface(const App::DocumentObjectT&);
|
||||
~TaskFitBSplineSurface();
|
||||
|
||||
public:
|
||||
void open();
|
||||
bool accept();
|
||||
|
||||
QDialogButtonBox::StandardButtons getStandardButtons() const
|
||||
{ return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
|
||||
|
||||
private:
|
||||
FitBSplineSurfaceWidget* widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
};
|
||||
|
||||
} //namespace ReenGui
|
||||
|
||||
#endif // REENGUI_FITBSPLINESURFACE_H
|
||||
380
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.ui
Normal file
380
src/Mod/ReverseEngineering/Gui/FitBSplineSurface.ui
Normal file
@@ -0,0 +1,380 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReenGui::FitBSplineSurface</class>
|
||||
<widget class="QWidget" name="ReenGui::FitBSplineSurface">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>472</width>
|
||||
<height>342</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fit B-Spline surface</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxU">
|
||||
<property name="title">
|
||||
<string>u-Direction</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Degree</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="degreeU">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UDegree</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Number of control points</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="polesU">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>NbUPoles</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBoxV">
|
||||
<property name="title">
|
||||
<string>v-Direction</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Degree</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="degreeV">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>VDegree</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Number of control points</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="polesV">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>NbVPoles</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Maximum number of iterations</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefSpinBox" name="iterations">
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Iterations</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Size factor</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="sizeFactor">
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Size factor</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBoxSmooth">
|
||||
<property name="title">
|
||||
<string>Smoothing</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Total Weight</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="totalWeight">
|
||||
<property name="maximum">
|
||||
<double>1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Total Weight</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Length of gradient</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="gradient">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Length of gradient</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Bending energy</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="bending">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Bending energy</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Curvature variation</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::PrefDoubleSpinBox" name="curvature">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>Curvature variation</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::PrefCheckBox" name="uvdir">
|
||||
<property name="text">
|
||||
<string>User-defined u/v directions</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>User-Defined UVDir</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/ReverseEngineering/BSplineFit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::PrefSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -32,11 +32,13 @@
|
||||
# define ReenGuiExport __declspec(dllexport)
|
||||
# define PartExport __declspec(dllimport)
|
||||
# define MeshExport __declspec(dllimport)
|
||||
# define PointsExport __declspec(dllimport)
|
||||
#else // for Linux
|
||||
# define ReenExport
|
||||
# define ReenGuiExport
|
||||
# define PartExport
|
||||
# define MeshExport
|
||||
# define PointsExport
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
Reference in New Issue
Block a user