X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintLength.cpp;h=ada7fa1d3318cca3dd3f2ed8f42b6ff149468621;hb=cdbbde4803e9c320204d537d22af4ac7ef024962;hp=1ba4aa081ff9e54a91a7af1b61fb40fd824aa74a;hpb=4289f04d4dcda1de53b4d33f63bc13e24a0fb650;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index 1ba4aa081..ada7fa1d3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2021 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 @@ -19,6 +19,7 @@ #include "SketchPlugin_ConstraintLength.h" #include +#include #include @@ -82,14 +83,6 @@ void SketchPlugin_ConstraintLength::execute() GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID())); if (aPoint1.get() && aPoint2.get()) { - double aLenght = aPoint1->pnt()->distance(aPoint2->pnt()); - - //std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - // ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); - //if(!aValueAttr->isInitialized()) { - // aValueAttr->setValue(aLenght); - //} - // the value should to be computed here, not in the getAISObject // in order to change the model value // inside the object transaction. This is important for creating a constraint by preselection. @@ -171,6 +164,8 @@ AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePreviou AISObjectPtr anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch(), thePrevious); + if (anAIS.get() && !thePrevious.get()) + SketchPlugin_Tools::setDimensionColor(anAIS); return anAIS; }