]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Task #3231: Sketcher Offset of a curve. Fix a bug with offset side in case of several...
authorjfa <jfa@opencascade.com>
Fri, 3 Jul 2020 12:14:25 +0000 (15:14 +0300)
committerjfa <jfa@opencascade.com>
Fri, 3 Jul 2020 12:14:25 +0000 (15:14 +0300)
src/SketchPlugin/SketchPlugin_Offset.cpp

index 2f01c4a8ccf409816a12e3142b83737d3aaa2c9d..4fb79fdec2149367d1b0bd1d298bd6b39078438f 100644 (file)
@@ -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<GeomAlgoAPI_Offset> anOffsetShape(
-          new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue));
+          new GeomAlgoAPI_Offset(aPlane, aWireShape, aValue*aSign));
 
       std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeList(new GeomAlgoAPI_MakeShapeList);
       aMakeList->appendAlgo(aWireBuilder);