App: [skip ci] add GeoFeaturePy::getPropertyOfGeometry

This commit is contained in:
wmayer
2020-09-13 13:14:21 +02:00
parent 50d531061b
commit a0ac281684
2 changed files with 26 additions and 1 deletions

View File

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

View File

@@ -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<PropertyComplexGeoData*>(prop)->getPyObject();
}
return Py::new_reference_to(Py::None());
}
PyObject *GeoFeaturePy::getCustomAttributes(const char* /*attr*/) const
{
return 0;