Salome HOME
Fix for the issue #2861. This issue 2861 is not a regression, but caused by order...
[modules/shaper.git] / src / Model / Model_Document.cpp
index 2cbfce82c5ea139a7bc2ee9aaeda2c61b34d24ac..337161e6f40128d7d8162c04249865a0953b1c47 100755 (executable)
@@ -1025,6 +1025,14 @@ FeaturePtr Model_Document::addFeature(std::string theID, const bool theMakeCurre
           aCurrent = aSub;
         }
       }
+      // #2861: if the parameter is added, add it after parameters existing in the list
+      if (aCurrent.get() && aFeature->getKind() == "Parameter") {
+        int anIndex = kUNDEFINED_FEATURE_INDEX;
+        for(FeaturePtr aNextFeat = myObjs->nextFeature(aCurrent, anIndex);
+            aNextFeat.get() && aNextFeat->getKind() == "Parameter";
+            aNextFeat = myObjs->nextFeature(aCurrent, anIndex))
+          aCurrent = aNextFeat;
+      }
     }
     aDocToAdd->myObjs->addFeature(aFeature, aCurrent);
     if (!aFeature->isAction()) {  // do not add action to the data model