From: azv Date: Fri, 29 Apr 2016 13:14:51 +0000 (+0300) Subject: Avoid incorrect fixing of a point on line after the external point removed (issue... X-Git-Tag: V_2.3.0~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=908f8bf97d07537a33c06349e86ea6a6aa4d7323;p=modules%2Fshaper.git Avoid incorrect fixing of a point on line after the external point removed (issue #1389) --- diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index aef46368a..dec3ead7e 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -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() || diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp index e7b72775d..8226bebd5 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp @@ -928,13 +928,23 @@ bool SolveSpaceSolver_Storage::removeCoincidence(ConstraintWrapperPtr theConstra aConstrIt->first->attribute(SketchPlugin_Constraint::ENTITY_A())); AttributeRefAttrPtr aRefAttrB = std::dynamic_pointer_cast( 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::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); }