Skip to content

Commit

Permalink
App: [skip ci] add GeoFeaturePy::getPropertyOfGeometry
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 13, 2020
1 parent a7ffe6e commit 82038bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/App/GeoFeaturePy.xml
Expand Up @@ -33,6 +33,17 @@ for a mesh the value Mesh and so on.
If an object has no such property then None is returned.</UserDocu>
</Documentation>
</Methode>
<Methode Name="getPropertyOfGeometry">
<Documentation>
<UserDocu>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.
</UserDocu>
</Documentation>
</Methode>
<CustomAttributes />
</PythonExport>
</GenerateModel>
16 changes: 15 additions & 1 deletion src/App/GeoFeaturePyImp.cpp
Expand Up @@ -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;
Expand All @@ -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<PropertyComplexGeoData*>(prop)->getPyObject();
}
return Py::new_reference_to(Py::None());
}

PyObject *GeoFeaturePy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
Expand Down

0 comments on commit 82038bb

Please sign in to comment.