From 76824fdb42315932b57b6db4496316d56753ede0 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 4 Oct 2018 11:14:25 +0300 Subject: [PATCH] Additional fix for the #2659 optimization --- src/Model/Model_BodyBuilder.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 365afd726..8428157d3 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -467,7 +467,18 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( TopoDS_Shape aShapeIn = theShapeIn->impl(); TopTools_MapOfShape aView; std::shared_ptr aData = std::dynamic_pointer_cast(data()); - TopExp_Explorer aShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape); + + TopoDS_Shape aShapeToIterate; + if (theMS->newShapesCollected(theShapeIn, theKindOfShape)) { + // use optimized set of old shapes for this + GeomShapePtr aCompound = theMS->oldShapesForNew(theShapeIn, aResultShape, theKindOfShape); + if (aCompound.get()) + aShapeToIterate = aCompound->impl(); + } else { + aShapeToIterate = aShapeIn; + } + + TopExp_Explorer aShapeExplorer (aShapeToIterate, (TopAbs_ShapeEnum)theKindOfShape); for (; aShapeExplorer.More(); aShapeExplorer.Next ()) { const TopoDS_Shape& aRoot = aShapeExplorer.Current (); if (!aView.Add(aRoot)) continue; @@ -482,6 +493,7 @@ void Model_BodyBuilder::loadAndOrientModifiedShapes ( std::shared_ptr aRShape(new GeomAPI_Shape()); aRShape->setImpl((new TopoDS_Shape(aRoot))); theMS->modified(aRShape, aList); + if (!theIsStoreSeparate) { //keepTopLevelShapes(aList, aRoot, aResultShape); removeBadShapes(aList); -- 2.39.2