Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchAPI / SketchAPI_Constraint.cpp
index a47cd7f08175a5a64a11a6bdb70d806a2153b250..1e063c61e9b7b498b983203fa5ec1b5618f4c1f5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  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
@@ -42,6 +42,8 @@
 
 #include <SketcherPrs_Tools.h>
 
+#include <limits>
+
 SketchAPI_Constraint::SketchAPI_Constraint(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
 : ModelHighAPI_Interface(theFeature)
@@ -89,6 +91,13 @@ void SketchAPI_Constraint::setValue(const ModelHighAPI_Double& theValue)
   fillAttribute(theValue, feature()->real(SketchPlugin_Constraint::VALUE()));
 }
 
+double SketchAPI_Constraint::value() const
+{
+  AttributeDoublePtr aValueAttr = feature()->real(SketchPlugin_Constraint::VALUE());
+  return aValueAttr->isInitialized() ? aValueAttr->value()
+                                     : std::numeric_limits<double>::quiet_NaN();
+}
+
 static const std::string& constraintTypeToSetter(const std::string& theType)
 {
   if (theType == SketchPlugin_ConstraintCoincidence::ID()) {