From 0f5e609761d2235dbffebd6cda89fa39bb253354 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 9 Jan 2020 10:21:23 +0300 Subject: [PATCH] Fix for the issue #18499 EDF 20572 - Problem of points selection in viewer - crash of the PartSet points selection for the Part compound. --- src/Model/Model_BodyBuilder.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index be65e0f40..2c5c5c381 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -183,7 +183,9 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, return; // null shape inside if(!theIsStoreSameShapes) { - Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab); + Handle(TNaming_NamedShape) aNS; + if (TNaming_Tool::HasLabel(aShapeLab, aShape)) + aNS = TNaming_Tool::NamedShape(aShape, aShapeLab); // the last condition is for the issue 2751 : existing shape may be found in compound-NS if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) { // This shape is already in document, store reference instead of shape; @@ -386,7 +388,9 @@ void Model_BodyBuilder::storeModified(const std::list& theOldShape if (aData.get()) { TDF_Label aShapeLab = aData->shapeLab(); TopoDS_Shape aShapeNew = theNewShape->impl(); - Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab); + Handle(TNaming_NamedShape) aNS; + if (TNaming_Tool::HasLabel(aShapeLab, aShapeNew)) + aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab); // the last condition is for the issue 2751 : existing shape may be found in compound-NS if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShapeNew)) { // This shape is already in document, store reference instead of shape; -- 2.39.2