Salome HOME
Issue #20274: No intersection point from python dump
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.cpp
index dac7f0aa30707da709887f763c9753fce9f98b7d..0e1d976fca48cc87ea24e64aec4c11d30610d309 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "ParametersAPI_Parameter.h"
@@ -23,6 +22,7 @@
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 #include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Events.h>
 //--------------------------------------------------------------------------------------
 ParametersAPI_Parameter::ParametersAPI_Parameter(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
@@ -92,3 +92,14 @@ ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
   return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
 }
+
+//--------------------------------------------------------------------------------------
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+                     const ParameterPtr & theParameter)
+{
+  FeaturePtr aParam = theParameter->feature();
+  if (aParam) {
+    ModelAPI_ReplaceParameterMessage::send(aParam, 0);
+    thePart->removeFeature(aParam);
+  }
+}