X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesAPI%2FFeaturesAPI_Measurement.cpp;h=8acd60f46513a0a8fb88d6da1d2121cd17fdaacb;hb=2e0f664e66dc2b46796df2953f52871b10799173;hp=466aa017808a766feac9dd5d95a8b2a4ff57602a;hpb=1c3738ae81b02ba62136ac03a53a81a532b95141;p=modules%2Fshaper.git diff --git a/src/FeaturesAPI/FeaturesAPI_Measurement.cpp b/src/FeaturesAPI/FeaturesAPI_Measurement.cpp index 466aa0178..8acd60f46 100644 --- a/src/FeaturesAPI/FeaturesAPI_Measurement.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Measurement.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2018-20xx CEA/DEN, EDF R&D +// Copyright (C) 2018-2019 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 @@ -12,10 +12,9 @@ // // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "FeaturesAPI_Measurement.h" @@ -115,3 +114,28 @@ std::list measureAngle(const std::shared_ptr& thePart return aValues; } + +double measureAngle(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& thePoint1, + const ModelHighAPI_Selection& thePoint2, + const ModelHighAPI_Selection& thePoint3) +{ + FeaturePtr aMeasure = thePart->addFeature(FeaturesPlugin_Measurement::ID()); + fillAttribute(FeaturesPlugin_Measurement::MEASURE_ANGLE_POINTS(), + aMeasure->string(FeaturesPlugin_Measurement::MEASURE_KIND())); + fillAttribute(thePoint1, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT1_ID())); + fillAttribute(thePoint2, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT2_ID())); + fillAttribute(thePoint3, aMeasure->selection(FeaturesPlugin_Measurement::ANGLE_POINT3_ID())); + aMeasure->execute(); + + // obtain result + AttributeDoubleArrayPtr aResult = std::dynamic_pointer_cast( + aMeasure->attribute(FeaturesPlugin_Measurement::RESULT_VALUES_ID())); + double aValue = aResult->size() ? aResult->value(0) : -1.0; + + // perform removing macro feature Measurement + thePart->removeFeature(aMeasure); + apply(); + + return aValue; +}