]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid incorrect fixing of a point on line after the external point removed (issue...
authorazv <azv@opencascade.com>
Fri, 29 Apr 2016 13:14:51 +0000 (16:14 +0300)
committerazv <azv@opencascade.com>
Fri, 29 Apr 2016 13:15:10 +0000 (16:15 +0300)
src/SketchSolver/SketchSolver_Manager.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp

index aef46368a1251c6b4180db8607f7fc43b4049095..dec3ead7e8c407f5e7a1ddb982027f6cfe6a0173 100644 (file)
@@ -547,8 +547,8 @@ void SketchSolver_Manager::degreesOfFreedom()
           aDoF -= 2; // attribute is a point
         else {
           FeaturePtr anAttr = ModelAPI_Feature::feature(aRefAttr->object());
-          assert(anAttr);
-          aDoF -= aDoFDelta[anAttr->getKind()];
+          if (anAttr)
+            aDoF -= aDoFDelta[anAttr->getKind()];
         }
       }
       else if (aFeature->getKind() == SketchPlugin_ConstraintMirror::ID() ||
index e7b72775d3adbaa1a09a8fb8a8fa42287eeefef7..8226bebd50dce1df5a5e095d781910795497ec2e 100644 (file)
@@ -928,13 +928,23 @@ bool SolveSpaceSolver_Storage::removeCoincidence(ConstraintWrapperPtr theConstra
           aConstrIt->first->attribute(SketchPlugin_Constraint::ENTITY_A()));
       AttributeRefAttrPtr aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
           aConstrIt->first->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      if (!aRefAttrA || !aRefAttrB || aRefAttrA->isObject() || aRefAttrB->isObject())
-        continue;
+      AttributePtr anAttrA, anAttrB;
+      if (aConstrIt->first->data()->isValid()) {
+        if (!aRefAttrA || !aRefAttrB || aRefAttrA->isObject() || aRefAttrB->isObject())
+          continue;
+        anAttrA = aRefAttrA->attr();
+        anAttrB = aRefAttrB->attr();
+      } else {
+        // obtain attributes from the constraint wrapper
+        ConstraintWrapperPtr aWrapper = aConstrIt->second.front();
+        anAttrA = aWrapper->entities().front()->baseAttribute();
+        anAttrB = aWrapper->entities().back()->baseAttribute();
+      }
       std::map<AttributePtr, EntityWrapperPtr>::iterator
-          aFound = myAttributeMap.find(aRefAttrA->attr());
+          aFound = myAttributeMap.find(anAttrA);
       if (aFound != myAttributeMap.end())
         aNotCoinc.erase(aFound->second);
-      aFound = myAttributeMap.find(aRefAttrB->attr());
+      aFound = myAttributeMap.find(anAttrB);
       if (aFound != myAttributeMap.end())
         aNotCoinc.erase(aFound->second);
     }