Salome HOME
Fixed validators for Boolean and Intersection
authordbv <dbv@opencascade.com>
Fri, 24 Jun 2016 13:52:03 +0000 (16:52 +0300)
committerdbv <dbv@opencascade.com>
Fri, 24 Jun 2016 13:52:03 +0000 (16:52 +0300)
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/GeomValidators/GeomValidators_IntersectionSelection.cpp

index 58c77cdd4a82a1a1593e1060691dce740e0781da..ff7d8cb391a1963bea496a14eba4ca6c7134ce00 100644 (file)
@@ -506,13 +506,19 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt
       return false;
     }
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
+    GeomShapePtr aContextShape = aContext->shape();
     if(!aShape.get()) {
-      aShape = aContext->shape();
+      aShape = aContextShape;
     }
     if(!aShape.get()) {
       theError = "Error: Empty shape.";
       return false;
     }
+    if(!aShape->isEqual(aContextShape)) {
+      theError = "Error: Local selection not allowed.";
+      return false;
+    }
+
     int aShapeType = aShape->shapeType();
     if(anOperationType == 1) {
       // Fuse operation. Allow to select edges, faces and solids.
index ec2a886e0e8b687b69469f670c1e4c664580b55c..039b0eda7b8484991d5bb3ded885bf7147c864e8 100644 (file)
@@ -47,13 +47,19 @@ bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttrib
       return false;
     }
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
+    GeomShapePtr aContextShape = aContext->shape();
     if(!aShape.get()) {
-      aShape = aContext->shape();
+      aShape = aContextShape;
     }
     if(!aShape.get()) {
       theError = "Error: empty shape.";
       return false;
     }
+    if(!aShape->isEqual(aContextShape)) {
+      theError = "Error: Local selection not allowed.";
+      return false;
+    }
+
     int aShapeType = aShape->shapeType();
     // Allow to select edges, faces and solids.
     if(aShapeType != GeomAPI_Shape::EDGE &&