View Issue Details

IDProjectCategoryView StatusLast Update
0000622PartDesignFeaturepublic2017-05-31 00:23
Reporterelectronlibre Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status confirmedResolutionopen 
Product Version0.12 
Summary0000622: Add taper angle feature in pad and pocket
DescriptionIt would be nice to have a taper angle option in pad and pocket tools (Part design workbench), similar to that on Extrude (Part WB).
TagsNo tags attached.
FreeCAD Information

Activities

2012-04-29 05:53

 

TaperAngle_Pad.patch (27,938 bytes)   
From a5036f1b89097d597cde84d6ff4605eca17120fe Mon Sep 17 00:00:00 2001
From: Jonathan Hahn <Jonathan.Hahn@t-online.de>
Date: Sun, 29 Apr 2012 09:45:19 +0200
Subject: [PATCH 1/2] adds TaperAngle to Pad

---
 src/Mod/PartDesign/App/FeaturePad.cpp        |  421 +++++++++++++++-----------
 src/Mod/PartDesign/App/FeaturePad.h          |    1 +
 src/Mod/PartDesign/Gui/TaskPadParameters.cpp |   39 ++-
 src/Mod/PartDesign/Gui/TaskPadParameters.h   |   12 +-
 src/Mod/PartDesign/Gui/TaskPadParameters.ui  |   35 ++-
 5 files changed, 308 insertions(+), 200 deletions(-)

diff --git a/src/Mod/PartDesign/App/FeaturePad.cpp b/src/Mod/PartDesign/App/FeaturePad.cpp
index 1a12c45..80075be 100644
--- a/src/Mod/PartDesign/App/FeaturePad.cpp
+++ b/src/Mod/PartDesign/App/FeaturePad.cpp
@@ -1,184 +1,239 @@
-/***************************************************************************
- *   Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net>        *
- *                                                                         *
- *   This file is part of the FreeCAD CAx development system.              *
- *                                                                         *
- *   This library is free software; you can redistribute it and/or         *
- *   modify it under the terms of the GNU Library General Public           *
- *   License as published by the Free Software Foundation; either          *
- *   version 2 of the License, or (at your option) any later version.      *
- *                                                                         *
- *   This library  is distributed in the hope that it will be useful,      *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU Library General Public License for more details.                  *
- *                                                                         *
- *   You should have received a copy of the GNU Library General Public     *
- *   License along with this library; see the file COPYING.LIB. If not,    *
- *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
- *   Suite 330, Boston, MA  02111-1307, USA                                *
- *                                                                         *
- ***************************************************************************/
-
-
-#include "PreCompiled.h"
-#ifndef _PreComp_
-//# include <Bnd_Box.hxx>
-//# include <gp_Pln.hxx>
-# include <BRep_Builder.hxx>
-# include <BRepBndLib.hxx>
-# include <BRepPrimAPI_MakePrism.hxx>
-# include <BRepBuilderAPI_Copy.hxx>
-# include <BRepBuilderAPI_MakeFace.hxx>
-//# include <Geom_Plane.hxx>
-# include <Handle_Geom_Surface.hxx>
-# include <TopoDS.hxx>
-# include <TopoDS_Solid.hxx>
-# include <TopoDS_Face.hxx>
-# include <TopoDS_Wire.hxx>
-# include <TopExp_Explorer.hxx>
-# include <BRepAlgoAPI_Fuse.hxx>
-# include <Precision.hxx>
-#endif
-
-#include <Base/Placement.h>
-#include <Mod/Part/App/Part2DObject.h>
-
-#include "FeaturePad.h"
-
-
-using namespace PartDesign;
-
-PROPERTY_SOURCE(PartDesign::Pad, PartDesign::Additive)
-
-Pad::Pad()
-{
-    ADD_PROPERTY(Length,(100.0));
-    ADD_PROPERTY(Reversed,(0));
-    ADD_PROPERTY(MirroredExtent,(0));
-}
-
-short Pad::mustExecute() const
-{
-    if (Placement.isTouched() ||
-        Sketch.isTouched() ||
-        Length.isTouched() ||
-        MirroredExtent.isTouched() ||
-        Reversed.isTouched())
-        return 1;
-    return 0;
-}
-
-App::DocumentObjectExecReturn *Pad::execute(void)
-{
-    double L = Length.getValue();
-    if (L < Precision::Confusion())
-        return new App::DocumentObjectExecReturn("Length of pad too small");
-    App::DocumentObject* link = Sketch.getValue();
-    if (!link)
-        return new App::DocumentObjectExecReturn("No sketch linked");
-    if (!link->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()))
-        return new App::DocumentObjectExecReturn("Linked object is not a Sketch or Part2DObject");
-    TopoDS_Shape shape = static_cast<Part::Part2DObject*>(link)->Shape.getShape()._Shape;
-    if (shape.IsNull())
-        return new App::DocumentObjectExecReturn("Linked shape object is empty");
-
-    // this is a workaround for an obscure OCC bug which leads to empty tessellations
-    // for some faces. Making an explicit copy of the linked shape seems to fix it.
-    // The error almost happens when re-computing the shape but sometimes also for the
-    // first time
-    BRepBuilderAPI_Copy copy(shape);
-    shape = copy.Shape();
-    if (shape.IsNull())
-        return new App::DocumentObjectExecReturn("Linked shape object is empty");
-
-    TopExp_Explorer ex;
-    std::vector<TopoDS_Wire> wires;
-    for (ex.Init(shape, TopAbs_WIRE); ex.More(); ex.Next()) {
-        wires.push_back(TopoDS::Wire(ex.Current()));
-    }
-    if (/*shape.ShapeType() != TopAbs_WIRE*/wires.empty()) // there can be several wires
-        return new App::DocumentObjectExecReturn("Linked shape object is not a wire");
-
-    // get the Sketch plane
-    Base::Placement SketchPos = static_cast<Part::Part2DObject*>(link)->Placement.getValue();
-    Base::Rotation SketchOrientation = SketchPos.getRotation();
-    Base::Vector3d SketchOrientationVector(0,0,1);
-    if (Reversed.getValue()) // negative direction
-        SketchOrientationVector *= -1;
-    SketchOrientation.multVec(SketchOrientationVector,SketchOrientationVector);
-
-    // get the support of the Sketch if any
-    App::DocumentObject* SupportLink = static_cast<Part::Part2DObject*>(link)->Support.getValue();
-    Part::Feature *SupportObject = 0;
-    if (SupportLink && SupportLink->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
-        SupportObject = static_cast<Part::Feature*>(SupportLink);
-
-    TopoDS_Shape aFace = makeFace(wires);
-    if (aFace.IsNull())
-        return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
-
-    // lengthen the vector
-    SketchOrientationVector *= L;
-
-    this->positionBySketch();
-    TopLoc_Location invObjLoc = this->getLocation().Inverted();
-
-    try {
-        // extrude the face to a solid
-        gp_Vec vec(SketchOrientationVector.x,SketchOrientationVector.y,SketchOrientationVector.z);
-        vec.Transform(invObjLoc.Transformation());
-        BRepPrimAPI_MakePrism PrismMaker(aFace.Moved(invObjLoc),vec,0,1);
-        if (PrismMaker.IsDone()) {
-            // if the sketch has a support fuse them to get one result object (PAD!)
-            if (SupportObject) {
-                // At this point the prism can be a compound
-                TopoDS_Shape result = PrismMaker.Shape();
-                // set the additive shape property for later usage in e.g. pattern
-                this->AddShape.setValue(result);
-
-                const TopoDS_Shape& support = SupportObject->Shape.getValue();
-                bool isSolid = false;
-                if (!support.IsNull()) {
-                    TopExp_Explorer xp;
-                    xp.Init(support,TopAbs_SOLID);
-                    for (;xp.More(); xp.Next()) {
-                        isSolid = true;
-                        break;
-                    }
-                }
-                if (isSolid) {
-                    // Let's call algorithm computing a fuse operation:
-                    BRepAlgoAPI_Fuse mkFuse(support.Moved(invObjLoc), result);
-                    // Let's check if the fusion has been successful
-                    if (!mkFuse.IsDone())
-                        return new App::DocumentObjectExecReturn("Fusion with support failed");
-                    result = mkFuse.Shape();
-                    // we have to get the solids (fuse create seldomly compounds)
-                    TopoDS_Shape solRes = this->getSolid(result);
-                    // lets check if the result is a solid
-                    if (solRes.IsNull())
-                        return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
-                    this->Shape.setValue(solRes);
-                }
-                else
-                    return new App::DocumentObjectExecReturn("Support is not a solid");
-            }
-            else {
-                TopoDS_Shape result = this->getSolid(PrismMaker.Shape());
-                // set the additive shape property for later usage in e.g. pattern
-                this->AddShape.setValue(result);
-                this->Shape.setValue(result);
+/***************************************************************************
+ *   Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net>        *
+ *                                                                         *
+ *   This file is part of the FreeCAD CAx development system.              *
+ *                                                                         *
+ *   This library is free software; you can redistribute it and/or         *
+ *   modify it under the terms of the GNU Library General Public           *
+ *   License as published by the Free Software Foundation; either          *
+ *   version 2 of the License, or (at your option) any later version.      *
+ *                                                                         *
+ *   This library  is distributed in the hope that it will be useful,      *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Library General Public License for more details.                  *
+ *                                                                         *
+ *   You should have received a copy of the GNU Library General Public     *
+ *   License along with this library; see the file COPYING.LIB. If not,    *
+ *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
+ *   Suite 330, Boston, MA  02111-1307, USA                                *
+ *                                                                         *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+#ifndef _PreComp_
+//# include <Bnd_Box.hxx>
+//# include <gp_Pln.hxx>
+# include <cmath>
+# include <BRep_Builder.hxx>
+# include <BRepBndLib.hxx>
+# include <BRepPrimAPI_MakePrism.hxx>
+# include <BRepBuilderAPI_Copy.hxx>
+# include <BRepBuilderAPI_MakeFace.hxx>
+# include <BRepOffsetAPI_MakeOffset.hxx>
+# include <BRepBuilderAPI_Transform.hxx>
+# include <BRepOffsetAPI_ThruSections.hxx>
+//# include <Geom_Plane.hxx>
+# include <Handle_Geom_Surface.hxx>
+# include <ShapeAnalysis.hxx>
+# include <TopoDS.hxx>
+# include <TopoDS_Solid.hxx>
+# include <TopoDS_Face.hxx>
+# include <TopoDS_Wire.hxx>
+# include <TopExp_Explorer.hxx>
+# include <BRepAlgoAPI_Fuse.hxx>
+# include <Precision.hxx>
+#endif
+
+#include <Base/Placement.h>
+#include <Base/Tools.h>
+#include <Mod/Part/App/Part2DObject.h>
+
+#include "FeaturePad.h"
+
+
+using namespace PartDesign;
+
+PROPERTY_SOURCE(PartDesign::Pad, PartDesign::Additive)
+
+Pad::Pad()
+{
+    ADD_PROPERTY(Length,(100.0));
+    ADD_PROPERTY(Reversed,(0));
+    ADD_PROPERTY(MirroredExtent,(0));
+    ADD_PROPERTY(TaperAngle,(0.0f));
+}
+
+short Pad::mustExecute() const
+{
+    if (Placement.isTouched() ||
+        Sketch.isTouched() ||
+        Length.isTouched() ||
+        MirroredExtent.isTouched() ||
+        Reversed.isTouched()||
+        TaperAngle.isTouched())
+        return 1;
+    return 0;
+}
+
+App::DocumentObjectExecReturn *Pad::execute(void)
+{
+    double L = Length.getValue();
+    if (L < Precision::Confusion())
+        return new App::DocumentObjectExecReturn("Length of pad too small");
+    App::DocumentObject* link = Sketch.getValue();
+    if (!link)
+        return new App::DocumentObjectExecReturn("No sketch linked");
+    if (!link->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId()))
+        return new App::DocumentObjectExecReturn("Linked object is not a Sketch or Part2DObject");
+    TopoDS_Shape shape = static_cast<Part::Part2DObject*>(link)->Shape.getShape()._Shape;
+    if (shape.IsNull())
+        return new App::DocumentObjectExecReturn("Linked shape object is empty");
+
+    // this is a workaround for an obscure OCC bug which leads to empty tessellations
+    // for some faces. Making an explicit copy of the linked shape seems to fix it.
+    // The error almost happens when re-computing the shape but sometimes also for the
+    // first time
+    BRepBuilderAPI_Copy copy(shape);
+    shape = copy.Shape();
+    if (shape.IsNull())
+        return new App::DocumentObjectExecReturn("Linked shape object is empty");
+
+    TopExp_Explorer ex;
+    std::vector<TopoDS_Wire> wires;
+    for (ex.Init(shape, TopAbs_WIRE); ex.More(); ex.Next()) {
+        wires.push_back(TopoDS::Wire(ex.Current()));
+    }
+    if (/*shape.ShapeType() != TopAbs_WIRE*/wires.empty()) // there can be several wires
+        return new App::DocumentObjectExecReturn("Linked shape object is not a wire");
+
+    // get the Sketch plane
+    Base::Placement SketchPos = static_cast<Part::Part2DObject*>(link)->Placement.getValue();
+    Base::Rotation SketchOrientation = SketchPos.getRotation();
+    Base::Vector3d SketchOrientationVector(0,0,1);
+    if (Reversed.getValue()) // negative direction
+        SketchOrientationVector *= -1;
+    SketchOrientation.multVec(SketchOrientationVector,SketchOrientationVector);
+
+    // get the support of the Sketch if any
+    App::DocumentObject* SupportLink = static_cast<Part::Part2DObject*>(link)->Support.getValue();
+    Part::Feature *SupportObject = 0;
+    if (SupportLink && SupportLink->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
+        SupportObject = static_cast<Part::Feature*>(SupportLink);
+
+    TopoDS_Shape aFace = makeFace(wires);
+    if (aFace.IsNull())
+        return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
+
+    // lengthen the vector
+    SketchOrientationVector *= L;
+
+    this->positionBySketch();
+    TopLoc_Location invObjLoc = this->getLocation().Inverted();
+
+    gp_Vec vec(SketchOrientationVector.x,SketchOrientationVector.y,SketchOrientationVector.z);
+    vec.Transform(invObjLoc.Transformation());
+
+    float taperAngle = TaperAngle.getValue();
+
+    TopoDS_Shape result;
+
+    try {
+
+        if (std::fabs(taperAngle) >= Precision::Confusion()) {
+
+            //get outer Wire
+            TopoDS_Wire outerWire = ShapeAnalysis::OuterWire(TopoDS::Face(aFace));
+
+            double distance = std::tan(Base::toRadians(taperAngle)) * vec.Magnitude();
+
+            std::list<TopoDS_Wire> wire_list;
+
+            wire_list.push_back(outerWire);
+
+            BRepOffsetAPI_MakeOffset mkOffset;
+
+            mkOffset.AddWire(outerWire);
+
+            mkOffset.Perform(distance);
+
+            gp_Trsf mat;
+            mat.SetTranslation(vec);
+            BRepBuilderAPI_Transform mkTransform(mkOffset.Shape(),mat);
+
+            wire_list.push_back(TopoDS::Wire(mkTransform.Shape()));
+
+            BRepOffsetAPI_ThruSections mkGenerator(Standard_True);
+
+            for (std::list<TopoDS_Wire>::const_iterator it = wire_list.begin(); it != wire_list.end(); ++it) {
+                const TopoDS_Wire &wire = *it;
+                mkGenerator.AddWire(wire);
             }
-        }
-        else
-            return new App::DocumentObjectExecReturn("Could not extrude the sketch!");
-
-        return App::DocumentObject::StdReturn;
-    }
-    catch (Standard_Failure) {
-        Handle_Standard_Failure e = Standard_Failure::Caught();
-        return new App::DocumentObjectExecReturn(e->GetMessageString());
-    }
-}
-
+            mkGenerator.Build();
+
+            result = mkGenerator.Shape();
+
+
+        }
+        //no taperAngle same as before
+        else{
+
+            // extrude the face to a solid
+            BRepPrimAPI_MakePrism PrismMaker(aFace.Moved(invObjLoc),vec,0,1);
+            if (PrismMaker.IsDone()) {
+
+                result = PrismMaker.Shape();
+            }
+            else
+                return new App::DocumentObjectExecReturn("Could not extrude the sketch!");
+        }
+
+        // if the sketch has a support fuse them to get one result object (PAD!)
+        if (SupportObject) {
+            // set the additive shape property for later usage in e.g. pattern
+            this->AddShape.setValue(result);
+            const TopoDS_Shape& support = SupportObject->Shape.getValue();
+            bool isSolid = false;
+            if (!support.IsNull()) {
+                TopExp_Explorer xp;
+                xp.Init(support,TopAbs_SOLID);
+                for (;xp.More(); xp.Next()) {
+                    isSolid = true;
+                    break;
+                }
+            }
+            if (isSolid) {
+                // Let's call algorithm computing a fuse operation:
+                BRepAlgoAPI_Fuse mkFuse(support.Moved(invObjLoc), result);
+                // Let's check if the fusion has been successful
+                if (!mkFuse.IsDone())
+                    return new App::DocumentObjectExecReturn("Fusion with support failed");
+                result = mkFuse.Shape();
+                // we have to get the solids (fuse create seldomly compounds)
+                TopoDS_Shape solRes = this->getSolid(result);
+                // lets check if the result is a solid
+                if (solRes.IsNull())
+                    return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
+                this->Shape.setValue(solRes);
+            }
+            else
+                return new App::DocumentObjectExecReturn("Support is not a solid");
+        }
+        else {
+            // set the additive shape property for later usage in e.g. pattern
+            this->AddShape.setValue(result);
+            this->Shape.setValue(result);
+        }
+
+        return App::DocumentObject::StdReturn;
+    }
+    catch (Standard_Failure) {
+        Handle_Standard_Failure e = Standard_Failure::Caught();
+        return new App::DocumentObjectExecReturn(e->GetMessageString());
+    }
+}
+
+
+
+
diff --git a/src/Mod/PartDesign/App/FeaturePad.h b/src/Mod/PartDesign/App/FeaturePad.h
index c758c94..dfaa1f6 100644
--- a/src/Mod/PartDesign/App/FeaturePad.h
+++ b/src/Mod/PartDesign/App/FeaturePad.h
@@ -42,6 +42,7 @@ public:
     //App::PropertyEnumeration Side;
     App::PropertyBool Reversed;
     App::PropertyBool MirroredExtent;
+    App::PropertyAngle TaperAngle;
 
     /** @name methods override feature */
     //@{
diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp
index 8a902b2..71f23e6 100644
--- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp
+++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp
@@ -62,14 +62,17 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
     connect(ui->checkBoxMirrored, SIGNAL(toggled(bool)),
             this, SLOT(onMirrored(bool)));
     connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
-            this, SLOT(onReversed(bool)));
+            this, SLOT(onReversed(bool)));
+    connect(ui->taperAngle, SIGNAL(valueChanged(double)),
+            this, SLOT(onTaperAngleChanged(double)));
 
     this->groupLayout()->addWidget(proxy);
 
     PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
     double l = pcPad->Length.getValue();
     bool mirrored = pcPad->MirroredExtent.getValue();
-    bool reversed = pcPad->Reversed.getValue();
+    bool reversed = pcPad->Reversed.getValue();
+    double ta = pcPad->TaperAngle.getValue();
 
     ui->doubleSpinBox->setMinimum(0);
     ui->doubleSpinBox->setValue(l);
@@ -77,11 +80,13 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
     ui->checkBoxMirrored->setChecked(mirrored);
     // According to bug #0000521 the reversed option
     // shouldn't be de-activated if the pad has a support face
-    ui->checkBoxReversed->setChecked(reversed);
+    ui->checkBoxReversed->setChecked(reversed);
+
+    ui->taperAngle->setValue(ta);
 
     // Make sure that the spin box has the focus to get key events
     // Calling setFocus() directly doesn't work because the spin box is not
-    // yet visible. 
+    // yet visible.
     QMetaObject::invokeMethod(ui->doubleSpinBox, "setFocus", Qt::QueuedConnection);
 }
 
@@ -104,6 +109,13 @@ void TaskPadParameters::onReversed(bool on)
     PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
     pcPad->Reversed.setValue(on);
     pcPad->getDocument()->recomputeFeature(pcPad);
+}
+
+void TaskPadParameters::onTaperAngleChanged(double ta)
+{
+    PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
+    pcPad->TaperAngle.setValue(static_cast<float>(ta));
+    pcPad->getDocument()->recomputeFeature(pcPad);
 }
 
 double TaskPadParameters::getLength(void) const
@@ -119,6 +131,12 @@ bool   TaskPadParameters::getReversed(void) const
 bool   TaskPadParameters::getMirroredExtent(void) const
 {
     return ui->checkBoxMirrored->isChecked();
+}
+
+float TaskPadParameters::getTaperAngle(void) const
+{
+    float t = static_cast<float>(ui->taperAngle->value());
+    return static_cast<float>(ui->taperAngle->value());
 }
 
 TaskPadParameters::~TaskPadParameters()
@@ -158,12 +176,12 @@ TaskDlgPadParameters::~TaskDlgPadParameters()
 
 void TaskDlgPadParameters::open()
 {
-    
+
 }
 
 void TaskDlgPadParameters::clicked(int)
 {
-    
+
 }
 
 bool TaskDlgPadParameters::accept()
@@ -174,7 +192,8 @@ bool TaskDlgPadParameters::accept()
         //Gui::Command::openCommand("Pad changed");
         Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length = %f",name.c_str(),parameter->getLength());
         Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %i",name.c_str(),parameter->getReversed()?1:0);
-        Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirroredExtent = %i",name.c_str(),parameter->getMirroredExtent()?1:0);
+        Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirroredExtent = %i",name.c_str(),parameter->getMirroredExtent()?1:0);
+        Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.TaperAngle = %f",name.c_str(),parameter->getTaperAngle());
         Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
         if (!PadView->getObject()->isValid())
             throw Base::Exception(PadView->getObject()->getStatusString());
@@ -192,18 +211,18 @@ bool TaskDlgPadParameters::accept()
 bool TaskDlgPadParameters::reject()
 {
     // get the support and Sketch
-    PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject()); 
+    PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
     Sketcher::SketchObject *pcSketch;
     App::DocumentObject    *pcSupport;
     if (pcPad->Sketch.getValue()) {
-        pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue()); 
+        pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
         pcSupport = pcSketch->Support.getValue();
     }
 
     // role back the done things
     Gui::Command::abortCommand();
     Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
-    
+
     // if abort command deleted the object the support is visible again
     if (!Gui::Application::Instance->getViewProvider(pcPad)) {
         if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.h b/src/Mod/PartDesign/Gui/TaskPadParameters.h
index c16493c..d3f4a87 100644
--- a/src/Mod/PartDesign/Gui/TaskPadParameters.h
+++ b/src/Mod/PartDesign/Gui/TaskPadParameters.h
@@ -40,7 +40,7 @@ namespace Gui {
 class ViewProvider;
 }
 
-namespace PartDesignGui { 
+namespace PartDesignGui {
 
 
 
@@ -54,12 +54,14 @@ public:
 
     double getLength(void) const;
     bool   getReversed(void) const;
-    bool   getMirroredExtent(void) const;
+    bool   getMirroredExtent(void) const;
+    float   getTaperAngle(void) const;
 
 private Q_SLOTS:
     void onLengthChanged(double);
     void onMirrored(bool);
-    void onReversed(bool);
+    void onReversed(bool);
+    void onTaperAngleChanged(double);
 
 protected:
     void changeEvent(QEvent *e);
@@ -94,11 +96,11 @@ public:
     virtual bool accept();
     /// is called by the framework if the dialog is rejected (Cancel)
     virtual bool reject();
-    /// is called by the framework if the user presses the help button 
+    /// is called by the framework if the user presses the help button
     virtual bool isAllowedAlterDocument(void) const
     { return false; }
 
-    /// returns for Close and Help button 
+    /// returns for Close and Help button
     virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
     { return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
 
diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.ui b/src/Mod/PartDesign/Gui/TaskPadParameters.ui
index d407bbf..5048e66 100644
--- a/src/Mod/PartDesign/Gui/TaskPadParameters.ui
+++ b/src/Mod/PartDesign/Gui/TaskPadParameters.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>158</width>
-    <height>116</height>
+    <width>206</width>
+    <height>138</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -62,6 +62,30 @@
     </layout>
    </item>
    <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Taper Angle:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="taperAngle">
+       <property name="minimum">
+        <double>-180.000000000000000</double>
+       </property>
+       <property name="maximum">
+        <double>180.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>5.000000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
     <widget class="QCheckBox" name="checkBoxMirrored">
      <property name="enabled">
       <bool>false</bool>
@@ -80,6 +104,13 @@
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>changeMode</tabstop>
+  <tabstop>doubleSpinBox</tabstop>
+  <tabstop>taperAngle</tabstop>
+  <tabstop>checkBoxMirrored</tabstop>
+  <tabstop>checkBoxReversed</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>
-- 
1.7.9.5


From b5761db235d803e5d0020ea2c7fc15747759b148 Mon Sep 17 00:00:00 2001
From: Jonathan Hahn <Jonathan.Hahn@t-online.de>
Date: Sun, 29 Apr 2012 09:52:17 +0200
Subject: [PATCH 2/2] removes TabStop changes

---
 src/Mod/PartDesign/Gui/TaskPadParameters.ui |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.ui b/src/Mod/PartDesign/Gui/TaskPadParameters.ui
index 5048e66..5623a40 100644
--- a/src/Mod/PartDesign/Gui/TaskPadParameters.ui
+++ b/src/Mod/PartDesign/Gui/TaskPadParameters.ui
@@ -104,13 +104,6 @@
    </item>
   </layout>
  </widget>
- <tabstops>
-  <tabstop>changeMode</tabstop>
-  <tabstop>doubleSpinBox</tabstop>
-  <tabstop>taperAngle</tabstop>
-  <tabstop>checkBoxMirrored</tabstop>
-  <tabstop>checkBoxReversed</tabstop>
- </tabstops>
  <resources/>
  <connections/>
 </ui>
-- 
1.7.9.5

TaperAngle_Pad.patch (27,938 bytes)   

Jriegel

2012-05-18 10:38

administrator   ~0002058

Patch applied to Assembly branch!

Works well!

To be done -> Use code in Pocket

helo10

2012-06-08 11:26

reporter   ~0002156

in progress

jrheinlaender

2013-01-13 14:32

developer   ~0002845

V0.13 now has a PartDesign::Draft feature which allows to select faces and apply a draft angle to them.

This is not the same functionality as that requested, but will lead to the same result.

I am not sure whether we should put even more options into the Pad/Pocket features. When I modelled for customers from the German automative industry, they insisted on always having draft in a separate feature.

Jriegel

2013-01-13 14:39

administrator   ~0002846

Draft can be done Pocket/Pad for easy and simple cases. If you want to have more control Pad/Pocket get for sure overloaded.
I think both make sense. A one angle solution in the basic features and a own feature for the more sophisticated (future) solutions..

I have generally no problem if there are overlapping features functionality.
May the better win!

Issue History

Date Modified Username Field Change
2012-03-05 21:17 electronlibre New Issue
2012-03-09 06:07 Jriegel Status new => assigned
2012-03-09 06:07 Jriegel Assigned To => Jriegel
2012-04-29 05:53 helo10 File Added: TaperAngle_Pad.patch
2012-05-05 18:00 yorik Project FreeCAD => PartDesign
2012-05-18 10:38 Jriegel Note Added: 0002058
2012-06-08 11:26 helo10 Note Added: 0002156
2013-01-13 14:32 jrheinlaender Note Added: 0002845
2013-01-13 14:39 Jriegel Note Added: 0002846
2017-05-31 00:23 Kunda1 Assigned To Jriegel =>
2017-05-31 00:23 Kunda1 Status assigned => confirmed