diff --git a/src/Mod/PartDesign/App/BodyPy.xml b/src/Mod/PartDesign/App/BodyPy.xml index aa3e05abe3..8aadafec57 100644 --- a/src/Mod/PartDesign/App/BodyPy.xml +++ b/src/Mod/PartDesign/App/BodyPy.xml @@ -28,5 +28,11 @@ + + + Return the the visible feature of this body + + + diff --git a/src/Mod/PartDesign/App/BodyPyImp.cpp b/src/Mod/PartDesign/App/BodyPyImp.cpp index 83169f54ab..89f6a08320 100644 --- a/src/Mod/PartDesign/App/BodyPyImp.cpp +++ b/src/Mod/PartDesign/App/BodyPyImp.cpp @@ -30,6 +30,7 @@ #include "Mod/Part/App/Part2DObject.h" #include "Mod/PartDesign/App/Body.h" +#include "Mod/PartDesign/App/Feature.h" // inclusion of the generated files (generated out of ItemPy.xml) #include "BodyPy.h" @@ -89,3 +90,12 @@ PyObject* BodyPy::insertObject(PyObject *args) Py_Return; } + +Py::Object BodyPy::getVisibleFeature() const { + for(auto obj : getBodyPtr()->Group.getValues()) { + if(obj->Visibility.getValue() && obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + return Py::Object(obj->getPyObject(),true); + } + return Py::Object(); +} +