From: azv Date: Tue, 17 Nov 2015 12:47:46 +0000 (+0300) Subject: Fix the changing of fillet radius (issue #1074) X-Git-Tag: V_2.0.0~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d4c5c405de03b8f810afced1b90ee66783f94a78;p=modules%2Fshaper.git Fix the changing of fillet radius (issue #1074) --- diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 17555b3d4..6c8d15b96 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -325,3 +325,9 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) myEndUpdate = false; } } + +void SketchPlugin_Arc::setReversed(bool isReversed) +{ + std::dynamic_pointer_cast(attribute(INVERSED_ID()))->setValue(isReversed); + myParamBefore = 0.0; +} diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index efc90f529..121f34916 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -85,6 +85,10 @@ class SketchPlugin_Arc : public SketchPlugin_SketchEntity, public GeomAPI_IPrese /// \param theDeltaY the delta for Y coordinate is moved SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); + /// Updates the "reversed" flag + /// \param isReversed whether the arc will be reversed + void setReversed(bool isReversed); + /// Use plugin manager for features creation SketchPlugin_Arc(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp b/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp index c870c1ec1..75f1370ca 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp @@ -70,6 +70,8 @@ void SketchPlugin_ConstraintFillet::initAttributes() void SketchPlugin_ConstraintFillet::execute() { + static const double aTol = 1.e-7; + // the viewer update should be blocked in order to avoid the temporaty fillet sub-features visualization // before they are processed by the solver //std::shared_ptr aMsg = std::shared_ptr( @@ -230,10 +232,16 @@ void SketchPlugin_ConstraintFillet::execute() aTangentPntA = aTangentPntB; aTangentPntB = aTmp; } - std::dynamic_pointer_cast( - aNewArc->attribute(SketchPlugin_Arc::START_ID()))->setValue(aTangentPntA->x(), aTangentPntA->y()); - std::dynamic_pointer_cast( - aNewArc->attribute(SketchPlugin_Arc::END_ID()))->setValue(aTangentPntB->x(), aTangentPntB->y()); + std::shared_ptr aStartPoint = std::dynamic_pointer_cast( + aNewArc->attribute(SketchPlugin_Arc::START_ID())); + std::shared_ptr aEndPoint = std::dynamic_pointer_cast( + aNewArc->attribute(SketchPlugin_Arc::END_ID())); + if (aStartPoint->isInitialized() && aEndPoint->isInitialized() && + (aStartPoint->pnt()->xy()->distance(aTangentPntA) > aTol || + aEndPoint->pnt()->xy()->distance(aTangentPntB) > aTol)) + std::dynamic_pointer_cast(aNewArc)->setReversed(false); + aStartPoint->setValue(aTangentPntA->x(), aTangentPntA->y()); + aEndPoint->setValue(aTangentPntB->x(), aTangentPntB->y()); aNewArc->data()->blockSendAttributeUpdated(false); aNewArc->execute();