From: azv Date: Mon, 19 Dec 2016 11:43:22 +0000 (+0300) Subject: PlaneGCS: Sketch is moved when moving arc, attached to it by center. X-Git-Tag: before_porting_8.2.0~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=31be39725b4010d471d4b5ea302a2ed9aeecb552;p=modules%2Fshaper.git PlaneGCS: Sketch is moved when moving arc, attached to it by center. Change algorithm of calculation of arc characteristics (start and end angles), because reversed arcs had invalid values. --- diff --git a/src/SketchPlugin/Test/TestConstraintMirror.py b/src/SketchPlugin/Test/TestConstraintMirror.py index 16ab8201c..3f5ae6924 100644 --- a/src/SketchPlugin/Test/TestConstraintMirror.py +++ b/src/SketchPlugin/Test/TestConstraintMirror.py @@ -161,8 +161,8 @@ aMirror = aSketchFeature.addFeature("SketchConstraintMirror") aRefObjectA = aMirror.refattr("ConstraintEntityA") aRefObjectA.setObject(modelAPI_ResultConstruction(aMirrorLine.firstResult())) aRefListInitial = aMirror.reflist("ConstraintMirrorList") -aRefListInitial.append(aSketchArc1.lastResult()) aRefListInitial.append(aSketchLine1.lastResult()) +aRefListInitial.append(aSketchArc1.lastResult()) aRefListInitial.append(aSketchLine2.lastResult()) aMirror.execute() aSession.finishOperation() diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index b26213dcc..6c8527ada 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -414,22 +414,13 @@ void PlaneGCSSolver_Storage::processArc(const EntityWrapperPtr& theArc) *aRadius = aCenterPnt->distance(aStartPnt); if (!anArcFeature->lastResult()) return; - std::shared_ptr anArcEdge = - std::dynamic_pointer_cast(anArcFeature->lastResult()->shape()); - if (!anArcEdge) - return; - anArcEdge->getRange(*aStartAngle, *aEndAngle); - // verify the range is correct and not shifted to an angle - std::shared_ptr aDir(new GeomAPI_Dir2d(cos(*aStartAngle), sin(*aStartAngle))); - std::shared_ptr aCalcStartPnt( - new GeomAPI_Pnt2d(aCenterPnt->xy()->added(aDir->xy()->multiplied(*aRadius)))); - if (aCalcStartPnt->distance(aStartPnt) > tolerance) { - std::shared_ptr aDirToStart( - new GeomAPI_Dir2d(aStartPnt->xy()->decreased(aCenterPnt->xy()))); - double anAngle = aDir->angle(aDirToStart); - *aStartAngle += anAngle; - *aEndAngle += anAngle; - } + static std::shared_ptr OX(new GeomAPI_Dir2d(1.0, 0.0)); + std::shared_ptr aDir(new GeomAPI_Dir2d( + aStartPnt->xy()->decreased(aCenterPnt->xy()))); + *aStartAngle = OX->angle(aDir); + aDir = std::shared_ptr(new GeomAPI_Dir2d( + aEndPnt->xy()->decreased(aCenterPnt->xy()))); + *aEndAngle = OX->angle(aDir); // no need to constraint a fixed or a copied arc if (theArc->group() == GID_OUTOFGROUP || anArcFeature->isCopy())