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)