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 b8843ec8c5
commit c1ab98098e
8 changed files with 41 additions and 16 deletions

View File

@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include <CXX/Objects.hxx>
#include <Mod/Part/App/TopoShapePy.h>
#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<Part::TopoShapePy*>(p)->getTopoShapePtr()->getShape());
}
PyObject *FeatureAreaPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;