]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #94 fixed: crash when apply length and perpendicular constraints
authorazv <azv@opencascade.com>
Wed, 10 Sep 2014 05:26:47 +0000 (09:26 +0400)
committerazv <azv@opencascade.com>
Wed, 10 Sep 2014 05:26:47 +0000 (09:26 +0400)
Added the construction of the entity related to the line, on which the length constraint is applied

src/SketchSolver/SketchSolver_ConstraintGroup.cpp

index 0e1ad7790eb5f6235af9bc7ef57148a576b6590c..5870e9186c14ecd63bd4d95c8e88831e35eb3386 100644 (file)
@@ -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<ModelAPI_Data> 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);