]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Optimize performance of the sketch solver
authorazv <azv@opencascade.com>
Wed, 23 Sep 2015 06:04:26 +0000 (09:04 +0300)
committerazv <azv@opencascade.com>
Wed, 23 Sep 2015 06:05:45 +0000 (09:05 +0300)
src/SketchSolver/SketchSolver_Constraint.cpp
src/SketchSolver/SketchSolver_Constraint.h

index c1d0558f4ec08054ba0ccacc19ee227503173e64..187a7cae59dc96e422ac19407bd4a2732080047d 100644 (file)
@@ -221,8 +221,11 @@ void SketchSolver_Constraint::update(ConstraintPtr theConstraint)
   std::vector<Slvs_hConstraint>::iterator aCIter = mySlvsConstraints.begin();
   for (; aCIter != mySlvsConstraints.end(); aCIter++) {
     Slvs_Constraint aConstraint = myStorage->getConstraint(*aCIter);
-    if (aValueAttr)
+    if (aValueAttr) {
       aConstraint.valA = aValue;
+      if (aConstraint.type == SLVS_C_DIAMETER)
+        aConstraint.valA *= 2.0;
+    }
     Slvs_hEntity* aCoeffs[6] = {
         &aConstraint.ptA, &aConstraint.ptB,
         &aConstraint.entityA, &aConstraint.entityB,
index f4a15db60ff19e3445a04d1c3c420ffa7134cae6..974143246cff2f493fdf6547bc8941660265fd9f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <SketchPlugin_Constraint.h>
 
+#include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
 
 #include <string>
@@ -223,8 +224,10 @@ public:
 
   virtual void adjustConstraint()
   {
+    AttributeDoublePtr aValueAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+        myBaseConstraint->attribute(SketchPlugin_Constraint::VALUE()));
     Slvs_Constraint aConstraint = myStorage->getConstraint(mySlvsConstraints.front());
-    aConstraint.valA *= 2.0;
+    aConstraint.valA = 2.0 * aValueAttr->value();
     myStorage->updateConstraint(aConstraint);
   }
 };