From: vsr Date: Thu, 16 Dec 2010 15:56:48 +0000 (+0000) Subject: Add ExtractShape() function X-Git-Tag: V6_2_0a2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2d69c763c593f58d978e4600715815692fe4450e;p=modules%2Fgeom.git Add ExtractShape() function --- diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 4f0bafa32..7fd33ba85 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -2237,6 +2237,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): anObj = self.GetSubShape(aShape, ListOfIDs) return anObj + ## Extract shapes (main shape or sub-shape) of given type + # @param aShape shape + # @param aType shape type + def ExtractShapes(self, aShape, aType, sorted = False): + ret = [] + t = aShape.GetShapeType()._v + if hasattr(aType, "_v"): aType = aType._v + if t == aType: + ret.append(aShape ) + elif sorted: + ret = self.SubShapeAllSortedCentres(aShape, aType) + else: + ret = self.SubShapeAll(aShape, aType) + return ret + # end of l4_decompose_d ## @}