Salome HOME
Make construction elements correctly selected: points, axes, planes
[modules/shaper.git] / src / Model / Model_FeatureValidator.cpp
index 2bbad12d176b27e3f24b3067235b69657732e48a..b3b1b821687f13ebdadaed93bc9ed4772fde4f02 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        Model_FeatureValidator.cpp
 // Created:     8 Jul 2014
 // Author:      Vitaly SMETANNIKOV
@@ -15,8 +17,10 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& th
   const std::list<std::string>& theArguments) const
 {
   std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  if (!aData)
-    return false;
+  // "Action" features has no data, but still valid. e.g "Remove Part"  
+  if (!aData) {
+    return theFeature->isAction();
+  }
   if (!aData->isValid())
     return false;
   const std::string kAllTypes = "";
@@ -24,10 +28,10 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& th
   std::list<std::string>::iterator it = aLtAttributes.begin();
   for (; it != aLtAttributes.end(); it++) {
     AttributePtr anAttr = aData->attribute(*it);
-    if (!anAttr->isInitialized()) {
+    if (!anAttr->isInitialized()) { // attribute is not initialized
       std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind = 
         myNotObligatory.find(theFeature->getKind());
-      if (aFeatureFind == myNotObligatory.end() ||
+      if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling
           aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
         return false;
       }