From: mpv Date: Thu, 12 Oct 2017 12:26:07 +0000 (+0300) Subject: Fix the problem that for Remove Shapes the sub-result can be selected as a base objec... X-Git-Tag: V_2.9.1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ab125400ff3bb9f018cc558ee1f9d5d90c75f65;p=modules%2Fshaper.git Fix the problem that for Remove Shapes the sub-result can be selected as a base object. In case of compound of compsolids and other kinds of shapes this may lead to crash. --- diff --git a/src/FeaturesPlugin/remove_subshapes_widget.xml b/src/FeaturesPlugin/remove_subshapes_widget.xml index b2698e274..353881c45 100644 --- a/src/FeaturesPlugin/remove_subshapes_widget.xml +++ b/src/FeaturesPlugin/remove_subshapes_widget.xml @@ -27,7 +27,7 @@ email : webmaster.salome@opencascade.com - + #include #include +#include bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, const std::list& theArguments, @@ -46,6 +47,13 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, theError = "Error: Result construction selected."; return false; } + // additional check that the selected object is top-level result + if (theArguments.size() > 0 && *(theArguments.rbegin()) == "toplevel") { + if (ModelAPI_Tools::compSolidOwner(aContext).get()) { + theError = "Error: Only higher level shape allowed."; + return false; + } + } } else if(anAttributeType == ModelAPI_AttributeSelectionList::typeId()) { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute);