- //Insert from faces
- const std::string aFromName = "FromFace";
- int aFromTag = aToTag > 10000 ? aToTag : 10000;
- for(ListOfShape::const_iterator anIt = theFromFaces.cbegin(); anIt != theFromFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
- if(theDataMap->isBound(aFromFace)) {
- aFromFace = theDataMap->find(aFromFace);
+void storeSubShape(
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+ ResultBodyPtr theResultBody,
+ const GeomShapePtr theShape,
+ const GeomAPI_Shape::ShapeType theType,
+ const std::string& theName)
+{
+ for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
+ GeomShapePtr aSubShape = anExp.current();
+ if (!theResultBody->generated(aSubShape, theName)) {
+ int aNbSubs = theResultBody->numberOfSubs();
+ if (aNbSubs > 0) {
+ // check the modified shape is in the result body, don't store it if not
+ ListOfShape aNewShapes;
+ theMakeShape->modified(aSubShape, aNewShapes);
+ for (int i = 0; i < aNbSubs; ++i) {
+ ResultBodyPtr aSubRes = theResultBody->subResult(i);
+ GeomShapePtr aShape = aSubRes->shape();
+ ListOfShape::iterator aNewIt = aNewShapes.begin();
+ for (; aNewIt != aNewShapes.end(); ++aNewIt)
+ if (aShape->isSubShape(*aNewIt, false))
+ break;
+ if (aNewIt != aNewShapes.end()) {
+ // store from/to shapes as primitives and then store modification of them by the boolean
+ aSubRes->generated(aSubShape, theName, false);
+ aSubRes->loadModifiedShapes(theMakeShape, aSubShape, theType);
+ }
+ }
+ }
+ else {
+ // store from/to shapes as primitives and then store modification of them by the boolean
+ theResultBody->generated(aSubShape, theName, false);
+ theResultBody->loadModifiedShapes(theMakeShape, aSubShape, theType);
+ }