From: nds Date: Thu, 3 Mar 2016 15:27:44 +0000 (+0300) Subject: Full/single angle X-Git-Tag: V_2.2.0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b98b3e6f3c213eece262930dca161c4d256cb2a9;p=modules%2Fshaper.git Full/single angle --- diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index a5aea85fa..6254c1f00 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -24,7 +24,8 @@ public: SketchSolver_Constraint(theConstraint), myNumberOfObjects(0), myNumberOfCopies(0), - myAdjusted(false) + myAdjusted(false), + myIsFullValue(false) {} /// \brief Update constraint @@ -73,6 +74,7 @@ protected: protected: int myNumberOfObjects; ///< number of previous initial objects int myNumberOfCopies; ///< number of previous copies of initial objects + bool myIsFullValue; ///< value whether the angle/distance is a full or single for objects bool myAdjusted; ///< the constraint is already adjusted (to not do it several times) diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp index e2839f7b9..bd53679d9 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.cpp @@ -143,8 +143,12 @@ void SketchSolver_ConstraintMultiRotation::adjustConstraint() myCenterCoord[0] = aParams.front()->value(); myCenterCoord[1] = aParams.back()->value(); - myRotationVal[0] = sin(myAngle * PI / 180.0); - myRotationVal[1] = cos(myAngle * PI / 180.0); + double anAngleValue = myAngle; + if (myIsFullValue && myNumberOfCopies > 0) + anAngleValue /= myNumberOfCopies; + + myRotationVal[0] = sin(anAngleValue * PI / 180.0); + myRotationVal[1] = cos(anAngleValue * PI / 180.0); SketchSolver_ConstraintMulti::adjustConstraint(); } diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h index 69e792bcc..10087cc67 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h @@ -56,7 +56,6 @@ private: private: AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation double myAngle; ///< angle of rotation - bool myIsFullValue; ///< value whether the angle is a full or single for objects double myCenterCoord[2]; ///< coordinates of rotation center double myRotationVal[2]; ///< sinus and cosine of rotation angle diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp index dd740003a..2bea9a217 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.cpp @@ -148,9 +148,15 @@ void SketchSolver_ConstraintMultiTranslation::adjustConstraint() EntityWrapperPtr aEnd = myStorage->entity( myBaseConstraint->attribute(SketchPlugin_MultiTranslation::END_POINT_ID())); std::list aEndParams = aEnd->parameters(); + myDelta[0] = aEndParams.front()->value() - aStartParams.front()->value(); myDelta[1] = aEndParams.back()->value() - aStartParams.back()->value(); + if (myIsFullValue && myNumberOfCopies > 0) { + myDelta[0] /= myNumberOfCopies; + myDelta[1] /= myNumberOfCopies; + } + SketchSolver_ConstraintMulti::adjustConstraint(); } diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h index 59cb06f93..7c93d6d0e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h @@ -56,7 +56,6 @@ private: private: AttributePoint2DPtr myStartPointAttribute; AttributePoint2DPtr myEndPointAttribute; - bool myIsFullValue; double myDelta[2]; ///< increment of translation };