Core: GeoFeature: Add python binding to the new getGlobalPlacement()

This commit is contained in:
PaddleStroke
2024-10-03 10:01:31 -05:00
committed by Chris Hennes
parent efb79d1c96
commit 3475cf42d2
3 changed files with 40 additions and 1 deletions
+21
View File
@@ -57,6 +57,27 @@ PyObject* GeoFeaturePy::getGlobalPlacement(PyObject * args) {
}
}
PyObject* GeoFeaturePy::getGlobalPlacementOf(PyObject * args) {
PyObject* pyTargetObj;
PyObject* pyRootObj;
char* pname;
if (!PyArg_ParseTuple(args, "OOs", &pyTargetObj, &pyRootObj, &pname)) {
return nullptr;
}
auto* targetObj = static_cast<App::DocumentObjectPy*>(pyTargetObj)->getDocumentObjectPtr();
auto* rootObj = static_cast<App::DocumentObjectPy*>(pyRootObj)->getDocumentObjectPtr();
try {
Base::Placement p = GeoFeature::getGlobalPlacement(targetObj, rootObj, pname);
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, ""))