Salome HOME
Issue #464 just clear local context of the interpreter, not initialize it from scratch
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintRigid.cpp
index 3483973fe30f2ae5661d04de2e26a16984926532..3ab5794b2c6402fe1c0c7803da54da4bc9f7439d 100644 (file)
@@ -6,6 +6,7 @@
 #include <SketchPlugin_Circle.h>
 #include <SketchPlugin_ConstraintRigid.h>
 #include <SketchPlugin_Line.h>
+#include <SketchPlugin_Point.h>
 
 #include <GeomAPI_Pnt2d.h>
 #include <GeomAPI_XY.h>
@@ -35,17 +36,26 @@ void SketchSolver_ConstraintRigid::process()
   if (!myErrorMsg.empty() || myFeatureMap.empty())
     return;
 
+  Slvs_hEntity anEntID = myFeatureMap.begin()->second;
+  if (myStorage->isEntityFixed(anEntID, true)) {
+    myErrorMsg = SketchSolver_Error::ALREADY_FIXED();
+    return;
+  }
+
   if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Line::ID()) {
-    Slvs_Entity aLine = myStorage->getEntity(myFeatureMap.begin()->second);
+    Slvs_Entity aLine = myStorage->getEntity(anEntID);
     fixLine(aLine);
   }
   else if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Arc::ID()) {
-    Slvs_Entity anArc = myStorage->getEntity(myFeatureMap.begin()->second);
+    Slvs_Entity anArc = myStorage->getEntity(anEntID);
     fixArc(anArc);
   }
   else if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Circle::ID()) {
-    Slvs_Entity aCirc = myStorage->getEntity(myFeatureMap.begin()->second);
-    fixArc(aCirc);
+    Slvs_Entity aCirc = myStorage->getEntity(anEntID);
+    fixCircle(aCirc);
+  }
+  else if (myFeatureMap.begin()->first->getKind() == SketchPlugin_Point::ID()) {
+    fixPoint(anEntID);
   }
 }