Salome HOME
updated copyright message
[modules/shaper.git] / src / PythonAPI / geom / ShapeInfo.py
1 import GeomAlgoAPI
2
3 # A python implementation of shapeInfo functionality.
4 # By the given shape it will provide information, similar to data, displayed in the second part
5 # of Inspection Panel on selection of face, edge or vertex.
6 # The method returns a tuple with same data and in the same order as it is presented in the
7 # Information Panel: type of shape, then values (may be not-numerical, like Boolean 'Closed' for Polygon).
8 def shapeInfo(theShape):
9   anInfo = GeomAlgoAPI.GeomAlgoAPI_ShapeInfo(theShape)
10   aVals = anInfo.values()
11   aResList = [anInfo.shapeType()]
12   for aVal in aVals:
13     if aVal.type() == 0:
14       aResList.append(aVal.string())
15     elif aVal.type() == 1:
16       aResList.append(aVal.real())
17     elif aVal.type() == 2:
18       aResList.append(aVal.boolean())
19   return tuple(aResList)