From c68483238115b437c5e0b37de859fd8ca9676000 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Fri, 26 Jun 2020 16:24:50 +0300 Subject: [PATCH] Task #3231: Sketcher Offset of a curve Check the normal of filleting arc for correct orientation. --- src/SketchPlugin/SketchPlugin_Offset.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Offset.cpp b/src/SketchPlugin/SketchPlugin_Offset.cpp index 97798f7a1..fbbbf9a0d 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.cpp +++ b/src/SketchPlugin/SketchPlugin_Offset.cpp @@ -63,6 +63,8 @@ #include +static const double tolerance = 1.e-7; + SketchPlugin_Offset::SketchPlugin_Offset() { } @@ -100,7 +102,6 @@ void SketchPlugin_Offset::execute() AttributeDoublePtr aValueAttr = real(VALUE_ID()); if (!aValueAttr->isInitialized()) return; double aValue = aValueAttr->value(); - const double tolerance = 1.e-7; if (aValue < tolerance) return; // 2.a. Reversed? @@ -498,13 +499,18 @@ void SketchPlugin_Offset::updateExistentOrCreateNew(const GeomShapePtr& theShape findOrCreateFeatureByKind(sketch(), SketchPlugin_Arc::ID(), theFeature, thePoolOfFeatures); + GeomDirPtr aCircNormal = aCircEdge->normal(); + GeomDirPtr aSketchNormal = sketch()->coordinatePlane()->normal(); + if (aSketchNormal->dot(aCircNormal) < -tolerance) + std::swap(aFP, aLP); + bool aWasBlocked = theFeature->data()->blockSendAttributeUpdated(true); std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Arc::CENTER_ID()))->setValue(aCP); + (theFeature->attribute(SketchPlugin_Arc::END_ID()))->setValue(aLP); std::dynamic_pointer_cast (theFeature->attribute(SketchPlugin_Arc::START_ID()))->setValue(aFP); std::dynamic_pointer_cast - (theFeature->attribute(SketchPlugin_Arc::END_ID()))->setValue(aLP); + (theFeature->attribute(SketchPlugin_Arc::CENTER_ID()))->setValue(aCP); theFeature->data()->blockSendAttributeUpdated(aWasBlocked); } else if (aResEdge->isCircle()) { -- 2.39.2