pass
return 0, 0, ""
+## Returns a long value from enumeration type
+# Can be used for CORBA enumerator types like GEOM.shape_type
+# @ingroup l1_geompy_auxiliary
+def EnumToLong(theItem):
+ ret = theItem
+ if hasattr(theItem, "_v"): ret = theItem._v
+ return ret
+
## Kinds of shape enumeration
# @ingroup l1_geompy_auxiliary
kind = GEOM.GEOM_IKindOfShape
# @param aType shape type
def ExtractShapes(self, aShape, aType, sorted = False):
ret = []
- t = aShape.GetShapeType()._v
- if hasattr(aType, "_v"): aType = aType._v
+ t = EnumToLong(aShape.GetShapeType())
+ aType = EnumToLong(aType)
if t == aType:
ret.append(aShape )
elif sorted:
# automatic detection of the most appropriate shape limit type
lim = GEOM.SHAPE
for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
- Limit = lim._v
+ Limit = EnumToLong(lim)
pass
anObj = self.BoolOp.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
# automatic detection of the most appropriate shape limit type
lim = GEOM.SHAPE
for s in ListShapes: lim = min( lim, s.GetMaxShapeType() )
- Limit = lim._v
+ Limit = EnumToLong(lim)
pass
anObj = self.BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
# Example: see GEOM_TestMeasures.py
listSh = self.SubShapeAllIDs(theShape, theType)
Nb = len(listSh)
- if theShape.GetShapeType()._v == theType:
+ t = EnumToLong(theShape.GetShapeType())
+ theType = EnumToLong(theType)
+ if t == theType:
Nb = Nb + 1
pass
return Nb
# Example: see GEOM_TestMeasures.py
aDict = {}
for typeSh in ShapeType:
- if typeSh != "AUTO" and typeSh != "SHAPE":
- listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
- Nb = len(listSh)
- if theShape.GetShapeType()._v == ShapeType[typeSh]:
- Nb = Nb + 1
- pass
- aDict[typeSh] = Nb
+ if typeSh in ( "AUTO", "SHAPE" ): continue
+ listSh = self.SubShapeAllIDs(theShape, ShapeType[typeSh])
+ Nb = len(listSh)
+ if EnumToLon(theShape.GetShapeType()) == ShapeType[typeSh]:
+ Nb = Nb + 1
pass
+ aDict[typeSh] = Nb
pass
return aDict