From ea7fd1e0d47c98182940a347e095e4629ee12ac8 Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 28 Jan 2019 15:27:23 +0300 Subject: [PATCH] Debug using tests for groups movement: TestGroupMove2.py, Test1757.py --- src/CollectionPlugin/Test/TestGroupMove2.py | 4 ++-- src/Model/Model_AttributeSelection.cpp | 9 +++++++-- src/Model/Model_AttributeString.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/CollectionPlugin/Test/TestGroupMove2.py b/src/CollectionPlugin/Test/TestGroupMove2.py index 2fc004aec..46f1be056 100644 --- a/src/CollectionPlugin/Test/TestGroupMove2.py +++ b/src/CollectionPlugin/Test/TestGroupMove2.py @@ -18,7 +18,7 @@ ## email : webmaster.salome@opencascade.com ## -# Test that removed vertex, selected in the group makes group with one invalid element (empty shape) +# Test that removed vertex, selected in the group makes empty group => invalid one from salome.shaper import model from ModelAPI import * @@ -41,5 +41,5 @@ model.end() # Check group aFactory = ModelAPI_Session.get().validators() selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) +assert(selectionList.size() == 0) assert(aFactory.validate(Group_1.feature()) == False) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 517ef728d..813544312 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -1315,8 +1315,13 @@ bool Model_AttributeSelection::searchNewContext(std::shared_ptr if (!ModelAPI_Session::get()->validators()->isConcealed( aRefFeat->getKind(), (*aRef)->id())) continue; - if (!theDoc->isLaterByDep(aRefFeat, aThisFeature)) { - return true; // feature conceals result, return true, so the context will be removed + if (theDoc->isLaterByDep(aThisFeature, aRefFeat)) { + // for extrusion cut in python script the nested sketch reference may be concealed before + // it is nested, so, check this composite feature is valid + static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + // need to be validated to update the "Apply" state if not previewed + if (aFactory->validate(aRefFeat)) + return true; // feature conceals result, return true, so the context will be removed } } } diff --git a/src/Model/Model_AttributeString.h b/src/Model/Model_AttributeString.h index deabf7788..733cb88bd 100644 --- a/src/Model/Model_AttributeString.h +++ b/src/Model/Model_AttributeString.h @@ -46,7 +46,7 @@ class Model_AttributeString : public ModelAPI_AttributeString MODEL_EXPORT virtual std::string value(); protected: - /// Initializes attibutes + /// Initializes attributes Model_AttributeString(TDF_Label& theLabel); /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc) virtual void reinit(); -- 2.39.2