From: barate Date: Tue, 15 May 2012 09:49:22 +0000 (+0000) Subject: Fix bug in structural element generation when reference geom object is already a... X-Git-Tag: V6_5_0~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80804773f6d561323365e43f35ffaf6e732b35f2;p=modules%2Fgeom.git Fix bug in structural element generation when reference geom object is already a main shape --- diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py index 9a4ba87b2..538724268 100644 --- a/src/GEOM_PY/structelem/parts.py +++ b/src/GEOM_PY/structelem/parts.py @@ -137,11 +137,13 @@ class StructuralElementPart: self.name = name self.geom = getGeompy(studyId) self.baseShapesSet = set() - mainShape = self.geom.GetMainShape(groupGeomObj) - listIDs = self.geom.GetObjectIDs(groupGeomObj) - if mainShape is not None and listIDs is not None: - for id in listIDs: - self.baseShapesSet.add(SubShapeID(mainShape, id)) + self.isMainShape = groupGeomObj.IsMainShape() + if not self.isMainShape: + mainShape = self.geom.GetMainShape(groupGeomObj) + listIDs = self.geom.GetObjectIDs(groupGeomObj) + if mainShape is not None and listIDs is not None: + for id in listIDs: + self.baseShapesSet.add(SubShapeID(mainShape, id)) self.color = color if self.color is None: self.color = self._groupGeomObj.GetColor() @@ -235,6 +237,8 @@ class StructuralElementPart: """ Find and return the base sub-shapes in the structural element part. """ + if self.isMainShape: + return [self._groupGeomObj] subShapes = [] for subShapeID in self.baseShapesSet: subShape = subShapeID.getObj(self.geom)