From: azv Date: Tue, 24 Jun 2014 04:21:42 +0000 (+0400) Subject: Changes concerning to Radius constraint X-Git-Tag: V_0.4.4~267 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=feba3a1f2de1d9704031435fcaf7d16c4240b628;p=modules%2Fshaper.git Changes concerning to Radius constraint --- 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;