From: azv Date: Tue, 14 Jun 2022 05:05:17 +0000 (+0300) Subject: Implement SketchAPI_Constraint::value() method to get the value of constraint. X-Git-Tag: V9_9_1b1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=845084998a745e85392b5ab943f895c5896eb0ed;p=modules%2Fshaper.git Implement SketchAPI_Constraint::value() method to get the value of constraint. --- diff --git a/src/SketchAPI/SketchAPI_Constraint.cpp b/src/SketchAPI/SketchAPI_Constraint.cpp index 97e01c332..724308c52 100644 --- a/src/SketchAPI/SketchAPI_Constraint.cpp +++ b/src/SketchAPI/SketchAPI_Constraint.cpp @@ -42,6 +42,8 @@ #include +#include + SketchAPI_Constraint::SketchAPI_Constraint( const std::shared_ptr & 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::quiet_NaN(); +} + static const std::string& constraintTypeToSetter(const std::string& theType) { if (theType == SketchPlugin_ConstraintCoincidence::ID()) { diff --git a/src/SketchAPI/SketchAPI_Constraint.h b/src/SketchAPI/SketchAPI_Constraint.h index 19b2d50ea..82d3962bd 100644 --- a/src/SketchAPI/SketchAPI_Constraint.h +++ b/src/SketchAPI/SketchAPI_Constraint.h @@ -62,6 +62,8 @@ public: SKETCHAPI_EXPORT void setValue(const ModelHighAPI_Double& theValue); + SKETCHAPI_EXPORT double value() const; + /// Dump wrapped feature SKETCHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const;