From f0c652f8a1717e4afc44eacb1798e567328bfad6 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 2 Aug 2016 12:25:57 +0300 Subject: [PATCH] Issue #1649: Added "Reverse" flag handling. --- src/ConstructionPlugin/ConstructionPlugin_Plane.cpp | 9 ++++----- src/ConstructionPlugin/plane_widget.xml | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 29792e54b..c95d450ad 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -225,7 +225,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByLineAndPoint() std::shared_ptr aLin = anEdge->line(); std::shared_ptr aPnt = aVertex->point(); std::shared_ptr aNewPln(new GeomAPI_Pln(aPnt, aLin->direction())); - int aSize = aLin->distance(aPnt); + double aSize = aLin->distance(aPnt); aSize *= 2.0; aRes = GeomAlgoAPI_FaceBuilder::squareFace(aNewPln, aSize); } else { @@ -248,6 +248,8 @@ std::shared_ptr ConstructionPlugin_Plane::createByDistanceFromOth aFaceAttr->isInitialized() && aDistAttr->isInitialized()) { double aDist = aDistAttr->value(); + bool anIsReverse = boolean(REVERSE())->value(); + if(anIsReverse) aDist = -aDist; GeomShapePtr aShape = aFaceAttr->value(); if (!aShape.get()) { aShape = aFaceAttr->context()->shape(); @@ -309,6 +311,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByRotation() aFaceShape = aFaceSelection->context()->shape(); } std::shared_ptr aFace(new GeomAPI_Face(aFaceShape)); + aFace = makeRectangularFace(aFace, aFace->getPlane()); // Get axis. AttributeSelectionPtr anAxisSelection = selection(AXIS()); @@ -325,11 +328,7 @@ std::shared_ptr ConstructionPlugin_Plane::createByRotation() double anAngle = real(ANGLE())->value(); GeomAlgoAPI_Rotation aRotationAlgo(aFace, anAxis, anAngle); - std::shared_ptr aRes(new GeomAPI_Face(aRotationAlgo.shape())); - std::shared_ptr aNewPln = aRes->getPlane(); - - aRes = makeRectangularFace(aRes, aNewPln); return aRes; } diff --git a/src/ConstructionPlugin/plane_widget.xml b/src/ConstructionPlugin/plane_widget.xml index 5a9d74637..5e216574c 100644 --- a/src/ConstructionPlugin/plane_widget.xml +++ b/src/ConstructionPlugin/plane_widget.xml @@ -107,7 +107,10 @@ label="Angle" tooltip="Angle for rotation around axis." icon="icons/Construction/angle.png" - default="0"/> + min="0" + default="45"> + + -- 2.39.2