diff --git a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp
index c4584b7963..5c59e50e43 100644
--- a/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp
+++ b/src/Mod/PartDesign/Gui/AppPartDesignGui.cpp
@@ -58,6 +58,7 @@
#include "ViewProviderDatumCS.h"
#include "ViewProviderThickness.h"
#include "ViewProviderPipe.h"
+#include "ViewProviderLoft.h"
// use a different name to CreateCommand()
void CreatePartDesignCommands(void);
@@ -143,6 +144,7 @@ PyMODINIT_FUNC initPartDesignGui()
PartDesignGui::ViewProviderAddSub ::init();
PartDesignGui::ViewProviderPrimitive ::init();
PartDesignGui::ViewProviderPipe ::init();
+ PartDesignGui::ViewProviderLoft ::init();
// add resources and reloads the translators
loadPartDesignResource();
diff --git a/src/Mod/PartDesign/Gui/CMakeLists.txt b/src/Mod/PartDesign/Gui/CMakeLists.txt
index 4fce1d6bdd..8d8d176da3 100644
--- a/src/Mod/PartDesign/Gui/CMakeLists.txt
+++ b/src/Mod/PartDesign/Gui/CMakeLists.txt
@@ -138,6 +138,8 @@ SET(PartDesignGuiViewProvider_SRCS CommandPrimitive.cpp
ViewProviderPrimitive.cpp
ViewProviderPipe.h
ViewProviderPipe.cpp
+ ViewProviderLoft.h
+ ViewProviderLoft.cpp
)
SOURCE_GROUP("ViewProvider" FILES ${PartDesignGuiViewProvider_SRCS})
diff --git a/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc b/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc
index 313370adc4..2c5223a22a 100644
--- a/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc
+++ b/src/Mod/PartDesign/Gui/Resources/PartDesign.qrc
@@ -30,6 +30,8 @@
icons/PartDesign_Body_Tree.svg
icons/PartDesign_Additive_Pipe.svg
icons/PartDesign_Subtractive_Pipe.svg
+ icons/PartDesign_Additive_Loft.svg
+ icons/PartDesign_Subtractive_Loft.svg
icons/PartDesign_Additive_Box.svg
icons/PartDesign_Additive_Cylinder.svg
icons/PartDesign_Additive_Sphere.svg
diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Loft.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Loft.svg
new file mode 100644
index 0000000000..af5a0329b3
--- /dev/null
+++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Loft.svg
@@ -0,0 +1,303 @@
+
+
+
+
diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Pipe.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Pipe.svg
index c60a71ae93..4fccc6914f 100644
--- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Pipe.svg
+++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Additive_Pipe.svg
@@ -21,6 +21,17 @@
version="1.1">
+
+
+
+
@@ -179,6 +190,15 @@
id="linearGradient3845"
xlink:href="#linearGradient4166"
inkscape:collect="always" />
+
diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Loft.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Loft.svg
new file mode 100644
index 0000000000..a55ce59eb1
--- /dev/null
+++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Loft.svg
@@ -0,0 +1,314 @@
+
+
+
+
diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Pipe.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Pipe.svg
index 8e72798f02..c1a1588947 100644
--- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Pipe.svg
+++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Subtractive_Pipe.svg
@@ -21,6 +21,17 @@
version="1.1">
+
+
+
+
@@ -179,6 +190,15 @@
id="linearGradient3845"
xlink:href="#linearGradient4166"
inkscape:collect="always" />
+
image/svg+xml
-
+
@@ -247,8 +267,8 @@
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp
new file mode 100644
index 0000000000..10959bb93c
--- /dev/null
+++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp
@@ -0,0 +1,203 @@
+/***************************************************************************
+ * Copyright (c) 2015 Stefan Tröger *
+ * *
+ * 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
+#endif
+
+#include "ViewProviderLoft.h"
+//#include "TaskLoftParameters.h"
+#include "Workbench.h"
+#include "TaskLoftParameters.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace PartDesignGui;
+
+PROPERTY_SOURCE(PartDesignGui::ViewProviderLoft,PartDesignGui::ViewProvider)
+
+ViewProviderLoft::ViewProviderLoft()
+{
+}
+
+ViewProviderLoft::~ViewProviderLoft()
+{
+}
+
+std::vector ViewProviderLoft::claimChildren(void)const
+{
+ std::vector temp;
+ App::DocumentObject* sketch = static_cast(getObject())->Sketch.getValue();
+ if (sketch != NULL)
+ temp.push_back(sketch);
+
+ return temp;
+}
+
+void ViewProviderLoft::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
+{/*
+ QAction* act;
+ act = menu->addAction(QObject::tr("Edit pad"), receiver, member);
+ act->setData(QVariant((int)ViewProvider::Default));
+ PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);*/
+}
+
+bool ViewProviderLoft::doubleClicked(void)
+{
+ Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s',0)",this->pcObject->getNameInDocument());
+ return true;
+}
+
+bool ViewProviderLoft::setEdit(int ModNum)
+{
+ if (ModNum == ViewProvider::Default || ModNum == 1 ) {
+
+ setPreviewDisplayMode(true);
+ /*
+ // When double-clicking on the item for this pad the
+ // object unsets and sets its edit mode without closing
+ // the task panel
+ Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
+ TaskDlgLoftParameters *padDlg = qobject_cast(dlg);
+ if (padDlg && padDlg->getLoftView() != this)
+ padDlg = 0; // another pad left open its task panel
+ if (dlg && !padDlg) {
+ QMessageBox msgBox;
+ msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
+ msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ msgBox.setDefaultButton(QMessageBox::Yes);
+ int ret = msgBox.exec();
+ if (ret == QMessageBox::Yes)
+ Gui::Control().reject();
+ else
+ return false;
+ }
+
+ // clear the selection (convenience)
+ Gui::Selection().clearSelection();
+
+ // always change to PartDesign WB, remember where we come from
+ oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
+
+ // start the edit dialog
+ if (padDlg)
+ Gui::Control().showDialog(padDlg);
+ else
+ Gui::Control().showDialog(new TaskDlgLoftParameters(this,ModNum == 1));
+ */
+ return true;
+ }
+ else {
+ return ViewProviderPart::setEdit(ModNum);
+ }
+}
+
+void ViewProviderLoft::unsetEdit(int ModNum) {
+ setPreviewDisplayMode(false);
+ PartDesignGui::ViewProvider::unsetEdit(ModNum);
+}
+
+
+bool ViewProviderLoft::onDelete(const std::vector &s)
+{/*
+ PartDesign::Loft* pcLoft = static_cast(getObject());
+
+ // get the Sketch
+ Sketcher::SketchObject *pcSketch = 0;
+ if (pcLoft->Sketch.getValue())
+ pcSketch = static_cast(pcLoft->Sketch.getValue());
+
+ // if abort command deleted the object the sketch is visible again
+ if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
+ Gui::Application::Instance->getViewProvider(pcSketch)->show();
+
+ return ViewProvider::onDelete(s);*/
+}
+
+
+
+void ViewProviderLoft::highlightReferences(const bool on, bool auxillery)
+{/*
+ PartDesign::Loft* pcLoft = static_cast(getObject());
+ Part::Feature* base;
+ if(!auxillery)
+ base = static_cast(pcLoft->Spine.getValue());
+ else
+ base = static_cast(pcLoft->AuxillerySpine.getValue());
+
+ if (base == NULL) return;
+ PartGui::ViewProviderPart* svp = dynamic_cast(
+ Gui::Application::Instance->getViewProvider(base));
+ if (svp == NULL) return;
+
+ std::vector edges;
+ if(!auxillery)
+ edges = pcLoft->Spine.getSubValuesStartsWith("Edge");
+ else
+ edges = pcLoft->AuxillerySpine.getSubValuesStartsWith("Edge");
+
+ if (on) {
+ if (!edges.empty() && originalLineColors.empty()) {
+ TopTools_IndexedMapOfShape eMap;
+ TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
+ originalLineColors = svp->LineColorArray.getValues();
+ std::vector colors = originalLineColors;
+ colors.resize(eMap.Extent(), svp->LineColor.getValue());
+
+ for (std::string e : edges) {
+ int idx = atoi(e.substr(4).c_str()) - 1;
+ if (idx < colors.size())
+ colors[idx] = App::Color(1.0,0.0,1.0); // magenta
+ }
+ svp->LineColorArray.setValues(colors);
+ }
+ } else {
+ if (!edges.empty() && !originalLineColors.empty()) {
+ svp->LineColorArray.setValues(originalLineColors);
+ originalLineColors.clear();
+ }
+ }*/
+}
+
+QIcon ViewProviderLoft::getIcon(void) const {
+ QString str = QString::fromAscii("PartDesign_");
+ auto* prim = static_cast(getObject());
+ if(prim->getAddSubType() == PartDesign::FeatureAddSub::Additive)
+ str += QString::fromAscii("Additive_");
+ else
+ str += QString::fromAscii("Subtractive_");
+
+ str += QString::fromAscii("Loft.svg");
+ return Gui::BitmapFactory().pixmap(str.toStdString().c_str());
+}
+
diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.h b/src/Mod/PartDesign/Gui/ViewProviderLoft.h
new file mode 100644
index 0000000000..9680532f23
--- /dev/null
+++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * Copyright (c) 2015 Stefan Tröger *
+ * *
+ * 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 PARTGUI_ViewProviderLoft_H
+#define PARTGUI_ViewProviderLoft_H
+
+#include "ViewProviderAddSub.h"
+
+namespace PartDesignGui {
+
+class PartDesignGuiExport ViewProviderLoft : public ViewProviderAddSub
+{
+ PROPERTY_HEADER(PartDesignGui::ViewProviderLoft);
+
+public:
+ /// constructor
+ ViewProviderLoft();
+ /// destructor
+ virtual ~ViewProviderLoft();
+
+ /// grouping handling
+ std::vector claimChildren(void)const;
+ void setupContextMenu(QMenu*, QObject*, const char*);
+ bool doubleClicked();
+
+ virtual bool onDelete(const std::vector &);
+ void highlightReferences(const bool on, bool auxillery);
+
+protected:
+ virtual bool setEdit(int ModNum);
+ virtual void unsetEdit(int ModNum);
+ virtual QIcon getIcon(void) const;
+
+private:
+ std::vector originalLineColors;
+};
+
+
+} // namespace PartDesignGui
+
+
+#endif // PARTGUI_ViewProviderLoft_H