From: azv Date: Thu, 4 Oct 2018 08:32:28 +0000 (+0300) Subject: Revert selection of compsolid in RemoveSubshapes feature X-Git-Tag: CEA_2018-2~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f0c3b9832bcdd6bcfd57a6a81ff21dfb76bc0bb6;p=modules%2Fshaper.git Revert selection of compsolid in RemoveSubshapes feature --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp index 75b335b61..e4d61f163 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp @@ -133,8 +133,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) for(anIndex = 0; anIndex < aSubsToKeepNb; ++anIndex) { AttributeSelectionPtr anAttrSelectionInList = aSubShapesToKeepAttrList->value(anIndex); GeomShapePtr aSubShapeToKeep = anAttrSelectionInList->value(); - if (aSubShapeToKeep.get() && - (aSubShapeToKeep->isEqual(aSubShape) || aSubShapeToKeep->isSubShape(aSubShape))) { + if (aSubShapeToKeep.get() && aSubShapeToKeep->isEqual(aSubShape)) { break; } } @@ -174,8 +173,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged(const std::string& theID) for(anIndex = 0; anIndex < aSubsToRemoveNb; ++anIndex) { AttributeSelectionPtr anAttrSelectionInList = aSubShapesToRemoveAttrList->value(anIndex); GeomShapePtr aSubShapeToRemove = anAttrSelectionInList->value(); - if (aSubShapeToRemove.get() && - (aSubShapeToRemove->isEqual(aSubShape) || aSubShapeToRemove->isSubShape(aSubShape))) { + if (aSubShapeToRemove.get() && aSubShapeToRemove->isEqual(aSubShape)) { break; } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index d46d29316..aa78551d6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -906,10 +906,7 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePt return false; } - ListOfShape aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - // add to the list all sub-shapes of the compound due to they can be selected as a shapes to keep - for (GeomAPI_ShapeIterator anIt(aBaseShape); anIt.more(); anIt.next()) - aSubShapes.push_back(anIt.current()); + std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); for(int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) { bool isSameFound = false; AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py index 310a650ff..ff3c8d804 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes5.py @@ -55,6 +55,14 @@ Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPO Remove_SubShapes_1.setSubShapesToRemove([model.selection("COMPSOLID", "Partition_1_1_1/Partition_1_1_1")]) model.do() +# check error when compsolid is selected +assert(Remove_SubShapes_1.feature().error() != "") + +# fix the problematic feature +Remove_SubShapes_1.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3")]) +model.do() +assert(Remove_SubShapes_1.feature().error() == "") + # check number of sub-shapes model.testNbResults(Remove_SubShapes_1, 1) model.testNbSubResults(Remove_SubShapes_1, [2]) diff --git a/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py b/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py index 61955a4bd..ff61445e5 100644 --- a/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py +++ b/src/FeaturesPlugin/Test/TestRemoveSubShapes6.py @@ -55,6 +55,14 @@ Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPO Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")]) model.do() +# check error when compsolid is selected +assert(Remove_SubShapes_1.feature().error() != "") + +# fix the problematic feature +Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3")]) +model.do() +assert(Remove_SubShapes_1.feature().error() == "") + # check number of sub-shapes model.testNbResults(Remove_SubShapes_1, 1) model.testNbSubResults(Remove_SubShapes_1, [3])