From feba3a1f2de1d9704031435fcaf7d16c4240b628 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 24 Jun 2014 08:21:42 +0400 Subject: [PATCH] Changes concerning to Radius constraint --- src/SketchSolver/SketchSolver_ConstraintGroup.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index 1b7a78639..5aa275391 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -167,14 +167,14 @@ bool SketchSolver_ConstraintGroup::changeConstraint( if (aDistAttr) { aDistance = aDistAttr->value(); + // SketchPlugin circle defined by its radius, but SolveSpace uses constraint for diameter + if (aConstrType == SLVS_C_DIAMETER) + aDistance *= 2.0; if (aConstrMapIter != myConstraintMap.end() && fabs(aConstrIter->valA - aDistance) > tolerance) { myNeedToSolve = true; aConstrIter->valA = aDistance; } - // SketchPlugin circle defined by its radius, but SolveSpace uses constraint for diameter - if (aConstrType == SLVS_C_DIAMETER) - aDistance *= 2.0; } Slvs_hEntity aConstrEnt[CONSTRAINT_ATTR_SIZE]; // parameters of the constraint @@ -327,7 +327,7 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity( const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end()); // SketchPlugin features - boost::shared_ptr aFeature; + boost::shared_ptr aFeature = boost::dynamic_pointer_cast(theEntity); if (aFeature) { // Verify the feature by its kind @@ -1103,7 +1103,7 @@ int Search(const uint32_t& theEntityID, const std::vector& theEntities) int aVecSize = theEntities.size(); while (aResIndex >= 0 && theEntities[aResIndex].h > theEntityID) aResIndex--; - while (aResIndex < aVecSize && theEntities[aResIndex].h < theEntityID) + while (aResIndex < aVecSize && aResIndex >= 0 && theEntities[aResIndex].h < theEntityID) aResIndex++; if (aResIndex == -1) aResIndex = aVecSize; -- 2.39.2