Path.Area: added Sections python attribute

This commit is contained in:
Zheng, Lei 2017-01-24 14:37:52 +08:00
parent 67a16db6cb
commit aec39ec6ff
3 changed files with 20 additions and 0 deletions

View File

@ -206,6 +206,12 @@ public:
/** Get the combined shape */
TopoDS_Shape getShape(int index);
/** Return the number of sections */
std::size_t getSectionCount() {
build();
return mySections.size();
}
/** Add a OCC wire shape to CArea
*
* \arg \c area: output converted curved object to here

View File

@ -63,5 +63,11 @@ any operation</UserDocu>
<UserDocu>Get current algorithm parameters as a dictionary.</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Sections" ReadOnly="true">
<Documentation>
<UserDocu>List of sections in this area.</UserDocu>
</Documentation>
<Parameter Name="Sections" Type="List"/>
</Attribute>
</PythonExport>
</GenerateModel>

View File

@ -295,6 +295,14 @@ PyObject* AreaPy::getParamsDesc(PyObject *args, PyObject *keywds)
return dict;
}
Py::List AreaPy::getSections(void) const {
Py::List ret;
Area *area = getAreaPtr();
for(size_t i=0,count=area->getSectionCount(); i<count;++i)
ret.append(Part::shape2pyshape(getAreaPtr()->getShape(i)));
return ret;
}
// custom attributes get/set
PyObject *AreaPy::getCustomAttributes(const char* /*attr*/) const