]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2305: 1.1.2.2 To complete the operator FILL
authordbv <dbv@opencascade.com>
Fri, 1 Dec 2017 15:06:45 +0000 (18:06 +0300)
committerdbv <dbv@opencascade.com>
Fri, 1 Dec 2017 15:07:09 +0000 (18:07 +0300)
Fill now allows to select shapes with any kind of type.

src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/boolean_widget.xml

index 08af8844540ac2689460607338268b5610ccc36a..37cecf7af1755b4366c65b3d8ee1bb9fc749444f 100644 (file)
@@ -118,10 +118,14 @@ void FeaturesPlugin_Boolean::execute()
         aCompSolidsObjects[aContextShape].push_back(anObject);
       }
     } else {
-      if(anObject->shapeType() == GeomAPI_Shape::EDGE ||
-         anObject->shapeType() == GeomAPI_Shape::FACE) {
+      if(aType != BOOL_FILL
+        && (anObject->shapeType() == GeomAPI_Shape::EDGE
+          || anObject->shapeType() == GeomAPI_Shape::FACE))
+      {
         anEdgesAndFaces.push_back(anObject);
-      } else {
+      }
+      else
+      {
         anObjects.push_back(anObject);
       }
     }
@@ -136,8 +140,11 @@ void FeaturesPlugin_Boolean::execute()
       // It could be a construction plane.
       ResultPtr aContext = aToolAttr->context();
       aPlanes.push_back(aToolAttr->context()->shape());
-    } else if(aTool->shapeType() == GeomAPI_Shape::EDGE ||
-       aTool->shapeType() == GeomAPI_Shape::FACE) {
+    }
+    else if(aType != BOOL_FILL
+      && (aTool->shapeType() == GeomAPI_Shape::EDGE
+        || aTool->shapeType() == GeomAPI_Shape::FACE))
+    {
       anEdgesAndFaces.push_back(aTool);
     } else {
       aTools.push_back(aTool);
index 853037100234b21d18cd5330d293e58593c780bd..5ec81daa0a9627b4a020d9ab7083fb81031f6ce6 100644 (file)
@@ -629,33 +629,35 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt
       return false;
     }
 
-    int aShapeType = aShape->shapeType();
+    GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType();
+    std::set<GeomAPI_Shape::ShapeType> anAllowedTypes;
     if(anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) {
-      // Fuse operation. Allow to select edges, faces and solids.
-      if(aShapeType != GeomAPI_Shape::EDGE &&
-         aShapeType != GeomAPI_Shape::FACE &&
-         aShapeType != GeomAPI_Shape::SOLID &&
-         aShapeType != GeomAPI_Shape::COMPSOLID &&
-         aShapeType != GeomAPI_Shape::COMPOUND) {
-        theError = "Error: Selected shape has the wrong type.";
-        return false;
-      }
+      anAllowedTypes.insert(GeomAPI_Shape::EDGE);
+      anAllowedTypes.insert(GeomAPI_Shape::FACE);
+      anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
     } else if (anOperationType == FeaturesPlugin_Boolean::BOOL_FILL) {
-      if(aShapeType != GeomAPI_Shape::FACE &&
-         aShapeType != GeomAPI_Shape::SOLID &&
-         aShapeType != GeomAPI_Shape::COMPSOLID &&
-         aShapeType != GeomAPI_Shape::COMPOUND) {
-        theError = "Error: Selected shape has the wrong type.";
-        return false;
-      }
+      anAllowedTypes.insert(GeomAPI_Shape::VERTEX);
+      anAllowedTypes.insert(GeomAPI_Shape::EDGE);
+      anAllowedTypes.insert(GeomAPI_Shape::WIRE);
+      anAllowedTypes.insert(GeomAPI_Shape::FACE);
+      anAllowedTypes.insert(GeomAPI_Shape::SHELL);
+      anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
     } else {
-      if(aShapeType != GeomAPI_Shape::SOLID &&
-         aShapeType != GeomAPI_Shape::COMPSOLID &&
-         aShapeType != GeomAPI_Shape::COMPOUND) {
-        theError = "Error: Selected shape has the wrong type.";
-        return false;
-      }
+      anAllowedTypes.insert(GeomAPI_Shape::SOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID);
+      anAllowedTypes.insert(GeomAPI_Shape::COMPOUND);
     }
+
+    if(anAllowedTypes.find(aShapeType) == anAllowedTypes.end()
+      || (aResultConstruction.get() && aShapeType != GeomAPI_Shape::FACE)) {
+      theError = "Error: Selected shape has the wrong type.";
+      return false;
+    }
+
   }
 
   return true;
index a5c4e919502f7e567b52fe6a6fe68be3c39914e9..015c1d0e5ecf409bcd4ed3915749fcdbdb73aca3 100644 (file)
@@ -34,7 +34,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     label="Main objects"
     icon=""
     tooltip="Select objects"
-    type_choice="solids compsolids edges faces"
+    type_choice="vertices edges wires faces shells solids compsolids"
     use_choice="false"
     concealment="true">
     <validator id="PartSet_DifferentObjects"/>
@@ -44,7 +44,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     label="Tool objects"
     icon=""
     tooltip="Select tools"
-    type_choice="solids compsolids edges faces"
+    type_choice="vertices edges wires faces shells solids compsolids"
     use_choice="false"
     concealment="true" >
     <validator id="PartSet_DifferentObjects"/>