diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp
index 8d14edd68e..95cdfec811 100644
--- a/src/Mod/Path/App/Area.cpp
+++ b/src/Mod/Path/App/Area.cpp
@@ -146,6 +146,7 @@ Area::~Area() {
}
void Area::setPlane(const TopoDS_Shape &shape) {
+ clean();
if(shape.IsNull()) {
myWorkPlane.Nullify();
return;
@@ -156,7 +157,6 @@ void Area::setPlane(const TopoDS_Shape &shape) {
throw Base::ValueError("shape is not planar");
myWorkPlane = plane;
myTrsf = trsf;
- clean();
}
bool Area::isCoplanar(const TopoDS_Shape &s1, const TopoDS_Shape &s2) {
diff --git a/src/Mod/Path/App/Area.h b/src/Mod/Path/App/Area.h
index c035a49f1a..2799e8e612 100644
--- a/src/Mod/Path/App/Area.h
+++ b/src/Mod/Path/App/Area.h
@@ -242,8 +242,6 @@ protected:
void explode(const TopoDS_Shape &shape);
- bool isBuilt() const;
-
TopoDS_Shape findPlane(const TopoDS_Shape &shape, gp_Trsf &trsf);
public:
@@ -254,6 +252,8 @@ public:
Area(const Area &other, bool deep_copy=true);
virtual ~Area();
+ bool isBuilt() const;
+
/** Set a working plane
*
* \arg \c shape: a shape defining a working plane.
diff --git a/src/Mod/Path/App/AreaPy.xml b/src/Mod/Path/App/AreaPy.xml
index ad4a0a306f..29748b4185 100644
--- a/src/Mod/Path/App/AreaPy.xml
+++ b/src/Mod/Path/App/AreaPy.xml
@@ -98,7 +98,7 @@ same algorithm
-
+
The current workplane. If no plane is set, it is derived from the added shapes.
diff --git a/src/Mod/Path/App/AreaPyImp.cpp b/src/Mod/Path/App/AreaPyImp.cpp
index 3fb7f10893..2c22e456b8 100644
--- a/src/Mod/Path/App/AreaPyImp.cpp
+++ b/src/Mod/Path/App/AreaPyImp.cpp
@@ -178,10 +178,6 @@ struct AreaPyModifier {
static AreaPyModifier mod;
-namespace Part {
-extern PartExport Py::Object shape2pyshape(const TopoDS_Shape &shape);
-}
-
using namespace Path;
// returns a string which represents the object e.g. when printed in python
@@ -481,6 +477,15 @@ Py::Object AreaPy::getWorkplane(void) const {
return Part::shape2pyshape(getAreaPtr()->getPlane());
}
+void AreaPy::setWorkplane(Py::Object obj) {
+ PyObject* p = obj.ptr();
+ if (!PyObject_TypeCheck(p, &(Part::TopoShapePy::Type))) {
+ std::string error = std::string("type must be 'TopoShape', not ");
+ error += p->ob_type->tp_name;
+ throw Py::TypeError(error);
+ }
+ getAreaPtr()->setPlane(GET_TOPOSHAPE(p));
+}
// custom attributes get/set
diff --git a/src/Mod/Path/App/FeatureArea.cpp b/src/Mod/Path/App/FeatureArea.cpp
index 5d399a599c..759eca3b55 100644
--- a/src/Mod/Path/App/FeatureArea.cpp
+++ b/src/Mod/Path/App/FeatureArea.cpp
@@ -136,14 +136,7 @@ const std::vector &FeatureArea::getShapes() {
short FeatureArea::mustExecute(void) const
{
- if (Sources.isTouched())
- return 1;
- if (WorkPlane.isTouched())
- return 1;
-
- PARAM_PROP_TOUCHED(AREA_PARAMS_ALL)
-
- return Part::Feature::mustExecute();
+ return !myArea.isBuilt() || Part::Feature::mustExecute();
}
PyObject *FeatureArea::getPyObject()
diff --git a/src/Mod/Path/App/FeatureArea.h b/src/Mod/Path/App/FeatureArea.h
index b766491b81..6e2f087c88 100644
--- a/src/Mod/Path/App/FeatureArea.h
+++ b/src/Mod/Path/App/FeatureArea.h
@@ -60,6 +60,11 @@ public:
PARAM_PROP_DECLARE(AREA_PARAMS_ALL)
+ void setWorkPlane(const TopoDS_Shape &shape) {
+ WorkPlane.setValue(shape);
+ myArea.setPlane(shape);
+ }
+
private:
bool myBuild;
Area myArea;
diff --git a/src/Mod/Path/App/FeatureAreaPy.xml b/src/Mod/Path/App/FeatureAreaPy.xml
index e62d94ed16..da1b916d3d 100644
--- a/src/Mod/Path/App/FeatureAreaPy.xml
+++ b/src/Mod/Path/App/FeatureAreaPy.xml
@@ -24,6 +24,12 @@
Same usage as Path.Area.setParams(). This function stores the parameters in the properties.
+
+
+ The current workplane. If no plane is set, it is derived from the added shapes.
+
+
+
diff --git a/src/Mod/Path/App/FeatureAreaPyImp.cpp b/src/Mod/Path/App/FeatureAreaPyImp.cpp
index 755db26899..83d92732a9 100644
--- a/src/Mod/Path/App/FeatureAreaPyImp.cpp
+++ b/src/Mod/Path/App/FeatureAreaPyImp.cpp
@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include
+#include
#include "FeatureArea.h"
// inclusion of the generated files (generated out of FeatureAreaPy.xml)
@@ -80,6 +81,21 @@ PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds)
return Py_None;
}
+Py::Object FeatureAreaPy::getWorkPlane(void) const {
+ return Part::shape2pyshape(getFeatureAreaPtr()->getArea().getPlane());
+}
+
+void FeatureAreaPy::setWorkPlane(Py::Object obj) {
+ PyObject* p = obj.ptr();
+ if (!PyObject_TypeCheck(p, &(Part::TopoShapePy::Type))) {
+ std::string error = std::string("type must be 'TopoShape', not ");
+ error += p->ob_type->tp_name;
+ throw Py::TypeError(error);
+ }
+ getFeatureAreaPtr()->setWorkPlane(
+ static_cast(p)->getTopoShapePtr()->getShape());
+}
+
PyObject *FeatureAreaPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;