Path.Area: Changed FeatureArea WorkPlane behavior

FeatureArea will return the user defined workplane if there is one, or
else it returns auto selected plane by its internal Area object
This commit is contained in:
Zheng, Lei
2017-03-09 12:15:11 +08:00
committed by wmayer
parent f028bde0df
commit 73649495e6
8 changed files with 41 additions and 16 deletions

View File

@@ -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