Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
authorsbh <sergey.belash@opencascade.com>
Tue, 14 Apr 2015 14:56:08 +0000 (17:56 +0300)
committersbh <sergey.belash@opencascade.com>
Tue, 14 Apr 2015 14:56:08 +0000 (17:56 +0300)
src/SketchSolver/SketchSolver_ConstraintRigid.cpp
src/SketchSolver/SketchSolver_Error.h
src/SketchSolver/SketchSolver_Group.cpp

index 3483973fe30f2ae5661d04de2e26a16984926532..49fded0732536720edf771eb86dbf4f7dd9393df 100644 (file)
@@ -35,17 +35,23 @@ 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);
   }
 }
 
index e0446b558eb8e699510a45d027ecfafe3bb782aa..0ae33d3c60abb8c4d4ccf2f4131d273e5a43534f 100644 (file)
@@ -59,6 +59,12 @@ class SketchSolver_Error
     static const std::string MY_ERROR_VALUE("Mirror constraint has wrong attributes");
     return MY_ERROR_VALUE;
   }
+  /// Entity is already fixed
+  inline static const std::string& ALREADY_FIXED()
+  {
+    static const std::string MY_ERROR_VALUE("Entity already fixed");
+    return MY_ERROR_VALUE;
+  }
   /// Crash in SolveSpace
   inline static const std::string& SOLVESPACE_CRASH()
   {
index 58d822786f807d1b4b92446b4e8be22be41dde35..d7049b111884fe2ea710f69a77675d045308db56 100644 (file)
@@ -259,7 +259,8 @@ bool SketchSolver_Group::updateFeature(std::shared_ptr<SketchPlugin_Feature> the
   std::set<ConstraintPtr>::iterator aCIter = aConstraints.begin();
   for (; aCIter != aConstraints.end(); aCIter++) {
     ConstraintConstraintMap::iterator aSolConIter = myConstraints.find(*aCIter);
-    if (aSolConIter == myConstraints.end())
+    if (aSolConIter == myConstraints.end() || !aSolConIter->first->data() ||
+        !aSolConIter->first->data()->isValid())
       continue;
     myFeatureStorage->changeFeature(theFeature, aSolConIter->first);
     aSolConIter->second->addFeature(theFeature);
@@ -278,7 +279,8 @@ void SketchSolver_Group::moveFeature(std::shared_ptr<SketchPlugin_Feature> theFe
     return;
   aConstraint->setGroup(this);
   aConstraint->setStorage(myStorage);
-  setTemporary(aConstraint);
+  if (aConstraint->error().empty())
+    setTemporary(aConstraint);
 }
 
 // ============================================================================