From: Artem Zhidkov Date: Fri, 26 Jun 2020 13:24:50 +0000 (+0300) Subject: Task #3231: Sketcher Offset of a curve X-Git-Tag: V9_6_0a1~60^2~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c68483238115b437c5e0b37de859fd8ca9676000;p=modules%2Fshaper.git Task #3231: Sketcher Offset of a curve Check the normal of filleting arc for correct orientation. --- 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()) {