From 3dd265844d1369da755e0e94dd6a2806706bd055 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 12 Mar 2020 10:26:54 +0300 Subject: [PATCH] Fix for the performance regression in issue #2256 : Import BREP is 400 times longer in SHAPER than in GEOM --- src/FeaturesPlugin/Test/TestCopyMoveResult.py | 2 +- src/Model/Model_BodyBuilder.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/FeaturesPlugin/Test/TestCopyMoveResult.py b/src/FeaturesPlugin/Test/TestCopyMoveResult.py index cebb307ac..6662ad6ff 100644 --- a/src/FeaturesPlugin/Test/TestCopyMoveResult.py +++ b/src/FeaturesPlugin/Test/TestCopyMoveResult.py @@ -48,7 +48,7 @@ Extrusion_1.result().setName("Origin") Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Extrusion_1_1_1")]) Copy_1 = model.addCopy(Part_1_doc, [model.selection("COMPSOLID", "Origin")], 1) Copy_1.result().setName("Origin_1") -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Origin_1_1/Copy_3][Origin_1_1/Copy_7]"), model.selection("EDGE", "[Origin_1_1/Copy_12][Origin_1_1/Copy_14]")], 2) +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Origin_1_1/Copy_2][Origin_1_1/Copy_6]"), model.selection("EDGE", "[Origin_1_2/Copy_4][Origin_1_2/Copy_6]")], 2) Fillet_1.result().setName("CopyCompound") model.do() # move the group feature to the end - through copy and fillet on this copy (to distinguish the origin and the copy) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index fd85d452a..9aa0b983b 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -936,8 +936,12 @@ int findAmbiguities(const TopoDS_Shape& theShapeIn, //======================================================================= void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& theName) { - if(theShape->isNull()) return; - TopoDS_Shape aShape = theShape->impl(); + GeomShapePtr aShapePtr = shape(); + if (theShape->isNull() || !aShapePtr.get()) + return; + TopoDS_Shape aShape = shape()->impl(); + if (aShape.IsNull()) + return; std::string aName; if (aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID) { TopoDS_Iterator itr(aShape); -- 2.39.2