From 170a907a4c2435cd41e8d70afefe25ce2529b7a6 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 4 Jun 2020 15:47:24 +0300 Subject: [PATCH] Added a unit-test for #21537 : Dumped file not loadable --- src/Model/Model_AttributeSelection.cpp | 5 ++- src/ModelAPI/CMakeLists.txt | 1 + src/ModelAPI/Test/Test19217.py | 42 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/ModelAPI/Test/Test19217.py diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 3badb0068..27ef884ad 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -2098,10 +2098,9 @@ ResultPtr Model_AttributeSelection::newestContext( } } } - // in case sketch line was selected for wire, but wire was concealed and not such line anymore, - // so, actually, the sketch element was selected (which is never concealed) + // in case sketch line was selected for wire, but wire was concealed and there is no such line + // anymore, so, actually, the sketch element was selected (which is never concealed) if (aResult != theCurrent && theCurrent->groupName() == ModelAPI_ResultConstruction::group()) { - //&& aResult->isConcealed()) std::list aConcealers; FeaturePtr aResFeature = aDoc->feature(aResult); FeaturePtr aThisFeature = std::dynamic_pointer_cast(owner()); diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index 19ad06cf7..461b1aa2e 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -259,4 +259,5 @@ ADD_UNIT_TESTS(TestConstants.py Test19019_2.py Test19031.py Test19058.py + Test19217.py ) diff --git a/src/ModelAPI/Test/Test19217.py b/src/ModelAPI/Test/Test19217.py new file mode 100644 index 000000000..b85b013a4 --- /dev/null +++ b/src/ModelAPI/Test/Test19217.py @@ -0,0 +1,42 @@ +# Copyright (C) 2014-2020 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Test if the Model_AttributeSelection::newestContext method work in case +# the initial shell is concealed by multi-rotation (all-feature selection) +# and the same sketch is used by a next shell. + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) +SketchCircle_1 = Sketch_1.addCircle(47.53111880904039, 63.23707920074999, 11.27757708463696) +model.do() +Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Shell_1")], model.selection("EDGE", "PartSet/OZ"), 3, keepSubResults = True) +Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")]) +model.end() + +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(Shell_2.feature())) + +assert(model.checkPythonDump()) \ No newline at end of file -- 2.39.2