diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp
index d0e015cf8e..b22e0a0512 100644
--- a/src/Mod/PartDesign/App/FeatureChamfer.cpp
+++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp
@@ -41,6 +41,7 @@
#include
#include
#include
+#include
#include
#include "FeatureChamfer.h"
@@ -52,12 +53,16 @@ using namespace PartDesign;
PROPERTY_SOURCE(PartDesign::Chamfer, PartDesign::DressUp)
const App::PropertyQuantityConstraint::Constraints floatSize = {0.0,FLT_MAX,0.1};
+const App::PropertyAngle::Constraints floatAngle = {0.0,89.99,0.1};
Chamfer::Chamfer()
{
ADD_PROPERTY(Size,(1.0));
Size.setUnit(Base::Unit::Length);
Size.setConstraints(&floatSize);
+ ADD_PROPERTY(Angle,(45.0));
+ Size.setUnit(Base::Unit::Angle);
+ Angle.setConstraints(&floatAngle);
}
short Chamfer::mustExecute() const
@@ -88,6 +93,10 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
if (size <= 0)
return new App::DocumentObjectExecReturn("Size must be greater than zero");
+ double angle = Base::toRadians(Angle.getValue());
+ if (angle <= 0 || angle > 89.99)
+ return new App::DocumentObjectExecReturn("Angle must be between 0 and 89.99");
+
this->positionByBaseFeature();
// create an untransformed copy of the basefeature shape
Part::TopoShape baseShape(TopShape);
@@ -103,11 +112,7 @@ App::DocumentObjectExecReturn *Chamfer::execute(void)
for (std::vector::const_iterator it=SubNames.begin(); it != SubNames.end(); ++it) {
TopoDS_Edge edge = TopoDS::Edge(baseShape.getSubShape(it->c_str()));
const TopoDS_Face& face = TopoDS::Face(mapEdgeFace.FindFromKey(edge).First());
-#if OCC_VERSION_HEX > 0x070300
- mkChamfer.Add(size, size, edge, face);
-#else
- mkChamfer.Add(size, edge, face);
-#endif
+ mkChamfer.AddDA(size, angle, edge, face);
}
mkChamfer.Build();
diff --git a/src/Mod/PartDesign/App/FeatureChamfer.h b/src/Mod/PartDesign/App/FeatureChamfer.h
index 583513dfa6..6a32708cd3 100644
--- a/src/Mod/PartDesign/App/FeatureChamfer.h
+++ b/src/Mod/PartDesign/App/FeatureChamfer.h
@@ -40,6 +40,7 @@ public:
Chamfer();
App::PropertyQuantityConstraint Size;
+ App::PropertyAngle Angle;
/** @name methods override feature */
//@{
diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp
index a9e3abeef9..68c4d9ec0c 100644
--- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp
+++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp
@@ -63,14 +63,24 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView, Q
this->groupLayout()->addWidget(proxy);
PartDesign::Chamfer* pcChamfer = static_cast(DressUpView->getObject());
- double r = pcChamfer->Size.getValue();
+ double r = pcChamfer->Size.getValue();
ui->chamferDistance->setUnit(Base::Unit::Length);
ui->chamferDistance->setValue(r);
ui->chamferDistance->setMinimum(0);
ui->chamferDistance->selectNumber();
ui->chamferDistance->bind(pcChamfer->Size);
QMetaObject::invokeMethod(ui->chamferDistance, "setFocus", Qt::QueuedConnection);
+
+ double a = pcChamfer->Angle.getValue();
+ ui->chamferAngle->setUnit(Base::Unit::Angle);
+ ui->chamferAngle->setValue(a);
+ ui->chamferAngle->setMinimum(0.0);
+ ui->chamferAngle->setMaximum(89.99);
+ ui->chamferAngle->selectAll();
+ ui->chamferAngle->bind(pcChamfer->Angle);
+ QMetaObject::invokeMethod(ui->chamferAngle, "setFocus", Qt::QueuedConnection);
+
std::vector strings = pcChamfer->Base.getSubValues();
for (std::vector::const_iterator i = strings.begin(); i != strings.end(); i++)
{
@@ -81,6 +91,8 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView, Q
connect(ui->chamferDistance, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));
+ connect(ui->chamferAngle, SIGNAL(valueChanged(double)),
+ this, SLOT(onAngleChanged(double)));
connect(ui->buttonRefAdd, SIGNAL(toggled(bool)),
this, SLOT(onButtonRefAdd(bool)));
connect(ui->buttonRefRemove, SIGNAL(toggled(bool)),
@@ -179,7 +191,7 @@ void TaskChamferParameters::onRefDeleted(void)
// erase the reference
refs.erase(refs.begin() + rowNumber);
// remove from the list
- ui->listWidgetReferences->model()->removeRow(rowNumber);
+ ui->listWidgetReferences->model()->removeRow(rowNumber);
}
// update the object
@@ -209,6 +221,19 @@ double TaskChamferParameters::getLength(void) const
return ui->chamferDistance->value().getValue();
}
+void TaskChamferParameters::onAngleChanged(double angle)
+{
+ PartDesign::Chamfer* pcChamfer = static_cast(DressUpView->getObject());
+ setupTransaction();
+ pcChamfer->Angle.setValue(angle);
+ pcChamfer->getDocument()->recomputeFeature(pcChamfer);
+}
+
+double TaskChamferParameters::getAngle(void) const
+{
+ return ui->chamferAngle->value().getValue();
+}
+
TaskChamferParameters::~TaskChamferParameters()
{
Gui::Selection().clearSelection();
diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.h b/src/Mod/PartDesign/Gui/TaskChamferParameters.h
index 7a3590b36e..14246e0d5a 100644
--- a/src/Mod/PartDesign/Gui/TaskChamferParameters.h
+++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.h
@@ -43,6 +43,7 @@ public:
private Q_SLOTS:
void onLengthChanged(double);
+ void onAngleChanged(double);
void onRefDeleted(void);
protected:
@@ -51,6 +52,7 @@ protected:
void changeEvent(QEvent *e);
virtual void onSelectionChanged(const Gui::SelectionChanges& msg);
double getLength(void) const;
+ double getAngle(void) const;
private:
Ui_TaskChamferParameters* ui;
diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.ui b/src/Mod/PartDesign/Gui/TaskChamferParameters.ui
index f35e2ce402..48bdcbded3 100644
--- a/src/Mod/PartDesign/Gui/TaskChamferParameters.ui
+++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.ui
@@ -57,15 +57,49 @@ click again to end selection
- -
-
+
-
+
+
-
+
+
+ Size
+
+
+
+ -
+
+
+
-
-
-
- Size:
-
-
+
+
-
+
+
+ Angle
+
+
+
+ -
+
+
+ deg
+
+
+ 0.000000000000000
+
+
+ 89.999999999999986
+
+
+ 0.100000000000000
+
+
+ 45.000000000000000
+
+
+
+