Skip to content

Commit

Permalink
PartDesign: add 'VisibleFeature' attribute to BodyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Aug 19, 2019
1 parent e2129f0 commit 530963d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Mod/PartDesign/App/BodyPy.xml
Expand Up @@ -28,5 +28,11 @@
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="VisibleFeature" ReadOnly="true">
<Documentation>
<UserDocu>Return the the visible feature of this body</UserDocu>
</Documentation>
<Parameter Name="VisibleFeature" Type="Object" />
</Attribute>
</PythonExport>
</GenerateModel>
10 changes: 10 additions & 0 deletions src/Mod/PartDesign/App/BodyPyImp.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}

0 comments on commit 530963d

Please sign in to comment.