]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Revert selection of compsolid in RemoveSubshapes feature
authorazv <azv@opencascade.com>
Thu, 4 Oct 2018 08:32:28 +0000 (11:32 +0300)
committerazv <azv@opencascade.com>
Thu, 4 Oct 2018 08:32:47 +0000 (11:32 +0300)
src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/Test/TestRemoveSubShapes5.py
src/FeaturesPlugin/Test/TestRemoveSubShapes6.py

index 75b335b61eede0794c06f50e54bf1a3ce0949fcd..e4d61f163b0066fa38a4ecd7ef87fe8dd4cc6b78 100644 (file)
@@ -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;
         }
       }
index d46d2931622106b6f6366580cd1e943c95893d2f..aa78551d6b665e30f0dcf7a03d678694efa7bb1a 100644 (file)
@@ -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<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
   for(int anIndex = 0; anIndex < aSubShapesAttrList->size(); ++anIndex) {
     bool isSameFound = false;
     AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex);
index 310a650ff179cb24feb7c88bc42a41628bc48c82..ff3c8d8047b4ec10dfdc4f4ee7ec0158256c50f5 100644 (file)
@@ -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])
index 61955a4bd4ff971afe83b27f9bbf5bd81816842f..ff61445e55733a9f75c1c0fbe84ecf3b3f6f0b96 100644 (file)
@@ -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])