From 8a4988df94b42bbb00f7e5cf8ace4f80e1c7b125 Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 10 Sep 2014 09:26:47 +0400 Subject: [PATCH] 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 --- src/SketchSolver/SketchSolver_ConstraintGroup.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); -- 2.39.2