From: vsv Date: Fri, 5 Dec 2014 15:14:38 +0000 (+0300) Subject: Issue #308: Do not select same object for boolean operation X-Git-Tag: V_0.6.0^2~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8e4bce82fd4f03e1652dba3df6dd6874c93f00e;p=modules%2Fshaper.git Issue #308: Do not select same object for boolean operation --- diff --git a/src/FeaturesPlugin/boolean_widget.xml b/src/FeaturesPlugin/boolean_widget.xml index af4822c2c..e64a63b4c 100644 --- a/src/FeaturesPlugin/boolean_widget.xml +++ b/src/FeaturesPlugin/boolean_widget.xml @@ -11,8 +11,9 @@ icon=":icons/cut_tool.png" tooltip="Select a tool" shape_types="solid" - concealment="true" - /> + concealment="true" > + + #include +#include #include @@ -130,6 +131,20 @@ bool PartSet_DifferentObjectsValidator::isValid(const FeaturePtr& theFeature, } } } + // Check selection attributes + anAttrs = theFeature->data()->attributes(ModelAPI_AttributeReference::type()); + if (anAttrs.size() > 0) { + std::list >::iterator anAttr = anAttrs.begin(); + for(; anAttr != anAttrs.end(); anAttr++) { + if (*anAttr) { + std::shared_ptr aRef = + std::dynamic_pointer_cast(*anAttr); + // check the object is already presented + if (aRef->isInitialized() && aRef->value() == theObject) + return false; + } + } + } return true; }