+ std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+ for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt) {
+ GeomShapePtr aSubShape = *anIt;
+ if (!aSubShape.get() || aSubShape->isNull())
+ continue;
+
+ int anIndex;
+ for(anIndex = 0; anIndex < aSubsNb; ++anIndex) {
+ AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex);
+ GeomShapePtr aLeftShape = anAttrSelectionInList->value();
+ if (aSubShape->isEqual(aLeftShape)) {
+ break; // found in a left-list
+ }
+ }
+ if (anIndex == aSubsNb) { // not found in left
+ aDeletedSubs->addDeleted(aSubShape);
+ aTypes.insert(aSubShape->shapeType());
+ if (aSubShape->shapeType() != GeomAPI_Shape::FACE) {
+ GeomAPI_ShapeExplorer aFaces(aSubShape, GeomAPI_Shape::FACE);
+ for(; aFaces.more(); aFaces.next())
+ aDeletedSubs->addDeleted(aFaces.current());
+ }
+ }
+ }
+ aMakeShapeList->appendAlgo(aDeletedSubs);
+
+ std::shared_ptr<GeomAlgoAPI_Copy> aCopy(new GeomAlgoAPI_Copy(aResultShape));
+ aResultShape = aCopy->shape();
+ aMakeShapeList->appendAlgo(aCopy);
+
+ if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ aResultShape = GeomAlgoAPI_ShapeTools::groupSharedTopology(aResultShape);
+ if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ // if the result has only one sub-shape, discard the compound
+ GeomAPI_ShapeIterator aSubIt(aResultShape);
+ GeomShapePtr aSub = aSubIt.current();
+ aSubIt.next();
+ if (!aSubIt.more())
+ aResultShape = aSub;
+ }
+ }