From: azv Date: Wed, 10 Sep 2014 05:26:47 +0000 (+0400) Subject: Issue #94 fixed: crash when apply length and perpendicular constraints X-Git-Tag: V_0.4.4~76^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8a4988df94b42bbb00f7e5cf8ace4f80e1c7b125;p=modules%2Fshaper.git Issue #94 fixed: crash when apply length and perpendicular constraints Added the construction of the entity related to the line, on which the length constraint is applied --- diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 0e1ad7790..5870e9186 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -264,11 +264,12 @@ bool SketchSolver_ConstraintGroup::changeConstraint( // For the length constraint the start and end points of the line should be added to the entities list instead of line if (aConstrType == SLVS_C_PT_PT_DISTANCE && theConstraint->getKind().compare(SketchPlugin_ConstraintLength::ID()) == 0) { - boost::shared_ptr aData = aFeature->data(); - aConstrEnt[indAttr] = changeEntity(aData->attribute(SketchPlugin_Line::START_ID())); - aConstrEnt[indAttr + 1] = changeEntity(aData->attribute(SketchPlugin_Line::END_ID())); - // measured object is added into the map of objects to avoid problems with interaction between constraint and group - myEntityFeatMap[aFeature] = 0; + Slvs_hEntity aLineEnt = changeEntity(aFeature); + int aEntPos = Search(aLineEnt, myEntities); + aConstrEnt[indAttr++] = myEntities[aEntPos].point[0]; + aConstrEnt[indAttr++] = myEntities[aEntPos].point[1]; + while (indAttr < CONSTRAINT_ATTR_SIZE) + aConstrEnt[indAttr++] = 0; break; // there should be no other entities } else if (aConstrAttr->isObject()) aConstrEnt[indAttr] = changeEntity(aFeature);