- aDump = aShape.getShapeStream()
- # Load shape to SALOME Geom
- aBrep = self.geompy.RestoreShape(aDump)
- aName = aBodyResult.data().name()
-
- # Make unique name
- aId = getObjectIndex(aName)
- if aId != 0:
- aName = aName + '_' + str(aId)
-
- self.geompy.addToStudy(aBrep, aName)
- self.geomObjects.append([aShape, aBrep])
+ if aShape is not None and not aShape.isNull():
+ aShapesList.append(aShape)
+ if len(aShapesList) == 1:
+ aName = aBodyResult.data().name()
+
+ # issue 1045: create compound if there are more than one shape
+ if len(aShapesList) > 1:
+ self.shape = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.compound(aShapesList)
+ aName = "ShaperResults"
+ elif len(aShapesList) == 1:
+ self.shape = aShapesList[0]
+
+ # so, only one shape is always in the result
+ aDump = self.shape.getShapeStream()
+ # Load shape to SALOME Geom
+ aBrep = self.geompy.RestoreShape(aDump)
+
+ # Make unique name
+ aId = getObjectIndex(aName)
+ if aId != 0:
+ aName = aName + '_' + str(aId)
+
+ self.geompy.addToStudy(aBrep, aName)
+ self.brep = aBrep