From: azv Date: Tue, 11 Apr 2017 10:17:21 +0000 (+0300) Subject: Issue #2128: Fatal error when select arc X-Git-Tag: V_2.7.0~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5af7dc6c1ea31200ade67ccac78e98b4b1cec8a2;p=modules%2Fshaper.git Issue #2128: Fatal error when select arc Do not process tangent arcs/circles as entities with shared point if this point is a center. --- diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index 1c42ac69a..0bc96168e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -26,7 +27,8 @@ static std::set collectCoincidences(FeaturePtr theFeature1, FeatureP /// \brief Check whether the entities has only one shared point or less. /// Return list of coincident points. -static std::list coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2); +static std::list coincidentBoundaryPoints(FeaturePtr theFeature1, + FeaturePtr theFeature2); /// \brief Check if two connected arcs have centers /// in same direction relatively to connection point @@ -109,7 +111,7 @@ void SketchSolver_ConstraintTangent::rebuild() getTangentFeatures(myBaseConstraint, aFeature1, aFeature2); // check number of coincident points - std::list aCoincidentPoints = coincidentPoints(aFeature1, aFeature2); + std::list aCoincidentPoints = coincidentBoundaryPoints(aFeature1, aFeature2); if (myType == CONSTRAINT_TANGENT_CIRCLE_LINE && aCoincidentPoints.size() > 1) { myErrorMsg = SketchSolver_Error::TANGENCY_FAILED(); return; @@ -186,7 +188,7 @@ void SketchSolver_ConstraintTangent::notify(const FeaturePtr& theFeature, } else if (mySharedPoint) { // The features are tangent in the shared point, but the coincidence has been removed. // Check if the coincidence is the same. - std::list aCoincidentPoints = coincidentPoints(aTgFeat1, aTgFeat2); + std::list aCoincidentPoints = coincidentBoundaryPoints(aTgFeat1, aTgFeat2); isRebuild = true; std::list::iterator anIt = aCoincidentPoints.begin(); for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt) @@ -238,7 +240,7 @@ std::set collectCoincidences(FeaturePtr theFeature1, FeaturePtr theF return aCoincidencesBetweenFeatures; } -std::list coincidentPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) +std::list coincidentBoundaryPoints(FeaturePtr theFeature1, FeaturePtr theFeature2) { std::set aCoincidences = collectCoincidences(theFeature1, theFeature2); // collect points only @@ -247,7 +249,12 @@ std::list coincidentPoints(FeaturePtr theFeature1, FeaturePtr theF for (; aCIt != aCoincidences.end(); ++ aCIt) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_A()); - if (aRefAttr && !aRefAttr->isObject()) { + if (!aRefAttr || aRefAttr->isObject()) + continue; + + AttributePtr anAttr = aRefAttr->attr(); + if (anAttr->id() != SketchPlugin_Arc::CENTER_ID() && + anAttr->id() != SketchPlugin_Circle::CENTER_ID()) { aCoincidentPoints.push_back(aRefAttr->attr()); break; }