diff --git a/src/App/GeoFeaturePy.xml b/src/App/GeoFeaturePy.xml index 5ded4b50b7..492e520567 100644 --- a/src/App/GeoFeaturePy.xml +++ b/src/App/GeoFeaturePy.xml @@ -33,6 +33,17 @@ for a mesh the value Mesh and so on. If an object has no such property then None is returned. + + + Returns the property of the actual geometry or None. +For example for a part object it returns its Shape property, +for a mesh its Mesh property and so on. +If an object has no such property then None is returned. +Unlike to getPropertyNameOfGeometry this function returns the geometry, +not its name. + + + diff --git a/src/App/GeoFeaturePyImp.cpp b/src/App/GeoFeaturePyImp.cpp index 7a73cc7f10..27a0fb30b7 100644 --- a/src/App/GeoFeaturePyImp.cpp +++ b/src/App/GeoFeaturePyImp.cpp @@ -62,7 +62,8 @@ PyObject* GeoFeaturePy::getGlobalPlacement(PyObject * args) { PyObject* GeoFeaturePy::getPropertyNameOfGeometry(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; + GeoFeature* object = this->getGeoFeaturePtr(); const PropertyComplexGeoData* prop = object->getPropertyOfGeometry(); const char* name = prop ? prop->getName() : 0; @@ -72,6 +73,19 @@ PyObject* GeoFeaturePy::getPropertyNameOfGeometry(PyObject * args) return Py::new_reference_to(Py::None()); } +PyObject* GeoFeaturePy::getPropertyOfGeometry(PyObject * args) +{ + if (!PyArg_ParseTuple(args, "")) + return nullptr; + + GeoFeature* object = this->getGeoFeaturePtr(); + const PropertyComplexGeoData* prop = object->getPropertyOfGeometry(); + if (prop) { + return const_cast(prop)->getPyObject(); + } + return Py::new_reference_to(Py::None()); +} + PyObject *GeoFeaturePy::getCustomAttributes(const char* /*attr*/) const { return 0;