- //load result
- if(theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape);
- } else {
- const int aDeletedTag = 1;
- const int aSubsolidsTag = 2; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aModifyTag = 100000;
- int aModifyToolsTag = 200000;
- std::ostringstream aStream;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
- std::string aModName = "Modified";
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyTag, aModName, theMapOfShapes, true);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDeletedTag);
-
- int anIndex = 1;
- for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
- aStream.str(std::string());
- aStream.clear();
- aStream << aModName << "_" << anIndex++;
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyToolsTag, aStream.str(), theMapOfShapes, true);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
- aModifyToolsTag += 10000;
+ GeomShapePtr aBaseShape;
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
+ for(GeomAPI_ShapeExplorer anObjectSubShapesExp(theObjectShape, theShapeType);
+ anObjectSubShapesExp.more();
+ anObjectSubShapesExp.next()) {
+ GeomShapePtr anObjectSubShape = anObjectSubShapesExp.current();
+ ListOfShape aModifiedShapes;
+ theMakeShape->modified(anObjectSubShape, aModifiedShapes);
+ for(ListOfShape::const_iterator aModIt = aModifiedShapes.cbegin(); aModIt != aModifiedShapes.cend(); ++aModIt) {
+ GeomShapePtr aModShape = *aModIt;
+ if(aMapOfSubShapes->isBound(aModShape)) {
+ aModShape = aMapOfSubShapes->find(aModShape);
+ }
+ if(theResultShape->isSubShape(aModShape)) {
+ aBaseShape = theObjectShape;
+ break;
+ }
+ }
+ if(aBaseShape.get()) {
+ break;