Expose global placement calculation to python API
This commit is contained in:
@@ -112,6 +112,9 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject*
|
||||
|
||||
Base::Placement GeoFeatureGroupExtension::globalGroupPlacement() {
|
||||
|
||||
if(getExtendedObject()->isRecomputing())
|
||||
throw Base::Exception("Global placement cannot be calculated on recompute");
|
||||
|
||||
return recursiveGroupPlacement(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<UserDocu>returns all possible paths to the root of the document</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getGlobalPlacement">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the placement of the object in the global coordinate space, respecting all stacked relationships.
|
||||
Note: This function is not available during recompute, as there the placements of parents can change
|
||||
after the execution of this object, rendering the result wrong.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPropertyNameOfGeometry">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the property name of the actual geometry or None.
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// inclusion of the generated files (generated out of GeoFeaturePy.xml)
|
||||
#include "GeoFeaturePy.h"
|
||||
#include "GeoFeaturePy.cpp"
|
||||
#include <Base/PlacementPy.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
using namespace App;
|
||||
@@ -44,6 +45,20 @@ PyObject* GeoFeaturePy::getPaths(PyObject * /*args*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* GeoFeaturePy::getGlobalPlacement(PyObject * args) {
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
Base::Placement p = static_cast<GeoFeature*>(getDocumentObjectPtr())->globalPlacement();
|
||||
return new Base::PlacementPy(new Base::Placement(p));
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
throw Py::RuntimeError(e.what());
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* GeoFeaturePy::getPropertyNameOfGeometry(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
|
||||
Reference in New Issue
Block a user