+ allow to set u/v dirs for B-Spline fit

This commit is contained in:
wmayer 2015-11-06 16:43:58 +01:00
parent 9bb0e7f75e
commit 94a62e015c
4 changed files with 25 additions and 9 deletions

View File

@ -33,7 +33,7 @@
using namespace App;
PROPERTY_SOURCE(App::Placement, App::DocumentObject)
PROPERTY_SOURCE(App::Placement, App::GeoFeature)
//===========================================================================

View File

@ -35,13 +35,14 @@
#include <Gui/BitmapFactory.h>
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/Selection.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>
#include <App/Placement.h>
using namespace ReenGui;
@ -65,7 +66,6 @@ FitBSplineSurfaceWidget::FitBSplineSurfaceWidget(const App::DocumentObjectT& obj
: d(new Private())
{
d->ui.setupUi(this);
d->ui.uvdir->setDisabled(true);
d->obj = obj;
restoreSettings();
}
@ -139,8 +139,22 @@ bool FitBSplineSurfaceWidget::accept()
.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))");
std::vector<App::Placement*> selection = Gui::Selection().getObjectsOfType<App::Placement>();
if (selection.size() != 1) {
QMessageBox::warning(this,
tr("Wrong selection"),
tr("Please select a single placement object to get local orientation.")
);
return false;
}
Base::Rotation rot = selection.front()->GeoFeature::Placement.getValue().getRotation();
Base::Vector3d u(1,0,0);
Base::Vector3d v(0,1,0);
rot.multVec(u, u);
rot.multVec(v, v);
argument += QString::fromLatin1(", UVDirs=(FreeCAD.Vector(%1,%2,%3), FreeCAD.Vector(%4,%5,%6))")
.arg(u.x).arg(u.y).arg(u.z).arg(v.x).arg(v.y).arg(v.z);
}
QString command = QString::fromLatin1("%1.addObject(\"Part::Spline\", \"Spline\").Shape = "
"ReverseEngineering.approxSurface(%2).toShape()")

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<width>360</width>
<height>342</height>
</rect>
</property>
@ -52,7 +52,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of control points</string>
<string>Control points</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -119,7 +119,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Number of control points</string>
<string>Control points</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -157,7 +157,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Maximum number of iterations</string>
<string>Iterations</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>

View File

@ -33,12 +33,14 @@
# define PartExport __declspec(dllimport)
# define MeshExport __declspec(dllimport)
# define PointsExport __declspec(dllimport)
# define AppExport __declspec(dllimport)
#else // for Linux
# define ReenExport
# define ReenGuiExport
# define PartExport
# define MeshExport
# define PointsExport
# define AppExport
#endif
#ifdef _MSC_VER