From ffe6257a4e16b117ea37dbc79258aa212da7aaef Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 3 Jul 2020 15:14:25 +0300 Subject: [PATCH] Task #3231: Sketcher Offset of a curve. Fix a bug with offset side in case of several chains. --- src/SketchPlugin/SketchPlugin_Offset.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Offset.cpp b/src/SketchPlugin/SketchPlugin_Offset.cpp index 2f01c4a8c..4fb79fdec 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.cpp +++ b/src/SketchPlugin/SketchPlugin_Offset.cpp @@ -171,6 +171,7 @@ void SketchPlugin_Offset::execute() // Fix for a problem of offset side change with selection change. // Wire direction is defined by the first selected edge of this wire. + double aSign = 1.; if (!aWire->isClosed()) { ListOfShape aModified; // First selected edge of current chain @@ -178,12 +179,12 @@ void SketchPlugin_Offset::execute() aWireBuilder->modified(aFirstSel, aModified); GeomShapePtr aModFS = aModified.front(); if (aModFS->orientation() != aFirstSel->orientation()) - aValue = -aValue; + aSign = -1.; } // 5.d. Make offset for the wire std::shared_ptr anOffsetShape( - new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue)); + new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue*aSign)); std::shared_ptr aMakeList(new GeomAlgoAPI_MakeShapeList); aMakeList->appendAlgo(aWireBuilder); -- 2.30.2