void PropertyPointKernel::setPyObject(PyObject *value) { if (PyObject_TypeCheck(value, &(PointsPy::Type))) { PointsPy *pcObject = (PointsPy*)value; setValue( *(pcObject->getPointKernelPtr())); } else { std::string error = std::string("type must be 'Points', not "); error += value->ob_type->tp_name; throw Base::TypeError(error); } }
Py::Object show(const Py::Tuple& args) { PyObject *pcObj; if (!PyArg_ParseTuple(args.ptr(), "O!", &(PointsPy::Type), &pcObj)) throw Py::Exception(); try { App::Document *pcDoc = App::GetApplication().getActiveDocument(); if (!pcDoc) pcDoc = App::GetApplication().newDocument(); PointsPy* pPoints = static_cast<PointsPy*>(pcObj); Points::Feature *pcFeature = (Points::Feature *)pcDoc->addObject("Points::Feature", "Points"); // copy the data //TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr()); pcFeature->Points.setValue(*(pPoints->getPointKernelPtr())); //pcDoc->recompute(); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); } return Py::None(); }
PyObject *PropertyPointKernel::getPyObject(void) { PointsPy* points = new PointsPy(&*_cPoints); points->setConst(); // set immutable return points; }