]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Partial fix for the issue #2437
authormpv <mpv@opencascade.com>
Thu, 15 Feb 2018 13:52:44 +0000 (16:52 +0300)
committermpv <mpv@opencascade.com>
Thu, 15 Feb 2018 13:52:57 +0000 (16:52 +0300)
src/Model/Model_BodyBuilder.cpp
src/Model/Model_ResultCompSolid.cpp

index 90ac2b21e928865b2438f8074b094a5dfb53d90f..9633826011ce623cb10f03dc8b2073b19a1bd2b1 100755 (executable)
@@ -215,7 +215,8 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theO
   if (aData) {
     TDF_Label& aShapeLab = aData->shapeLab();
     // clean builders
-    clean();
+    if (theDecomposeSolidsTag != -2)
+      clean();
     // store the new shape as primitive
     TNaming_Builder aBuilder(aShapeLab);
     if (!theOldShape || !theNewShape)
@@ -518,6 +519,9 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes (
         } else if (aNotInTree) {
           // not in tree -> store as primitive (stored as separated)
           builder(aBuilderTag)->Generated(aNewShape);
+        } else if (aNewShape.ShapeType() > aRoot.ShapeType()) {
+           // if lower-level type is produced, make it as generated
+          builder(aBuilderTag)->Generated(aRoot, aNewShape);
         } else {
           builder(aBuilderTag)->Modify(aRoot, aNewShape);
         }
index 2446e4048e2582c495b42e8d7165bd3d9b26131b..8cde4b9c4f53939bdfdce99d227452ca524f51d8 100755 (executable)
@@ -75,6 +75,25 @@ void Model_ResultCompSolid::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* t
   if (theSplitInSubs && mySubs.size()) { // consists of subs
     std::vector<std::shared_ptr<ModelAPI_ResultBody> >::const_iterator aSubIter = mySubs.cbegin();
     for(; aSubIter != mySubs.cend(); aSubIter++) {
+      // check that sub-shape was also created as modification of ShapeIn
+      /* to find when it is needed later to enable: to store modification of sub-bodies not only as primitives
+      GeomShapePtr aSubGeomShape = (*aSubIter)->shape();
+      if (!theIsStoreAsGenerated && aSubGeomShape.get() && !aSubGeomShape->isNull()) {
+        TopoDS_Shape aSubShape = aSubGeomShape->impl<TopoDS_Shape>();
+        TopoDS_Shape aWholeIn = theShapeIn->impl<TopoDS_Shape>();
+        for(TopExp_Explorer anExp(aWholeIn, aSubShape.ShapeType()); anExp.More(); anExp.Next()) {
+          ListOfShape aHistory;
+          std::shared_ptr<GeomAPI_Shape> aSubIn(new GeomAPI_Shape());
+          aSubIn->setImpl((new TopoDS_Shape(anExp.Current())));
+          theMS->modified(aSubIn, aHistory);
+          std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aHistory.begin();
+          for (; anIt != aHistory.end(); anIt++) {
+            if ((*anIt)->isSame(aSubGeomShape)) {
+              (*aSubIter)->storeModified(aSubIn, aSubGeomShape, -2); // -2 is to avoid clearing
+            }
+          }
+        }
+      }*/
       (*aSubIter)->loadAndOrientModifiedShapes(
         theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
         theIsStoreAsGenerated);
@@ -86,7 +105,6 @@ void Model_ResultCompSolid::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* t
   }
 }
 
-
 int Model_ResultCompSolid::numberOfSubs(bool forTree) const
 {
   return int(mySubs.size());