From: mpv Date: Thu, 15 Feb 2018 13:52:44 +0000 (+0300) Subject: Partial fix for the issue #2437 X-Git-Tag: V_3.0.0~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0fb6ac8ec037eab4f2512ea6fe7be1c6cc2e02b6;p=modules%2Fshaper.git Partial fix for the issue #2437 --- diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 90ac2b21e..963382601 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -215,7 +215,8 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr& 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); } diff --git a/src/Model/Model_ResultCompSolid.cpp b/src/Model/Model_ResultCompSolid.cpp index 2446e4048..8cde4b9c4 100755 --- a/src/Model/Model_ResultCompSolid.cpp +++ b/src/Model/Model_ResultCompSolid.cpp @@ -75,6 +75,25 @@ void Model_ResultCompSolid::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* t if (theSplitInSubs && mySubs.size()) { // consists of subs std::vector >::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 aWholeIn = theShapeIn->impl(); + for(TopExp_Explorer anExp(aWholeIn, aSubShape.ShapeType()); anExp.More(); anExp.Next()) { + ListOfShape aHistory; + std::shared_ptr aSubIn(new GeomAPI_Shape()); + aSubIn->setImpl((new TopoDS_Shape(anExp.Current()))); + theMS->modified(aSubIn, aHistory); + std::list >::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());