[PD] add option to create tapered Pad / Pocket
This PR adds the same functionality as provided by Part Extrude. The used code parts are sorted out to a new helper function that is used by Part and PartDesign.
This commit is contained in:
@@ -51,15 +51,17 @@
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Placement.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "FeatureExtrude.h"
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::FeatureExtrude, PartDesign::ProfileBased)
|
||||
|
||||
App::PropertyQuantityConstraint::Constraints FeatureExtrude::signedLengthConstraint = { -DBL_MAX, DBL_MAX, 1.0 };
|
||||
double FeatureExtrude::maxAngle = 90 - Base::toDegrees<double>(Precision::Angular());
|
||||
App::PropertyAngle::Constraints FeatureExtrude::floatAngle = { -maxAngle, maxAngle, 1.0 };
|
||||
|
||||
FeatureExtrude::FeatureExtrude()
|
||||
{
|
||||
@@ -71,6 +73,8 @@ short FeatureExtrude::mustExecute() const
|
||||
Type.isTouched() ||
|
||||
Length.isTouched() ||
|
||||
Length2.isTouched() ||
|
||||
TaperAngle.isTouched() ||
|
||||
TaperAngle2.isTouched() ||
|
||||
UseCustomVector.isTouched() ||
|
||||
Direction.isTouched() ||
|
||||
ReferenceAxis.isTouched() ||
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
#ifndef PARTDESIGN_FEATURE_EXTRUDE_H
|
||||
#define PARTDESIGN_FEATURE_EXTRUDE_H
|
||||
|
||||
#include <App/PropertyGeo.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <App/PropertyUnits.h>
|
||||
#include <Base/Tools.h>
|
||||
#include "FeatureSketchBased.h"
|
||||
|
||||
namespace PartDesign
|
||||
@@ -41,6 +43,8 @@ public:
|
||||
App::PropertyEnumeration Type;
|
||||
App::PropertyLength Length;
|
||||
App::PropertyLength Length2;
|
||||
App::PropertyAngle TaperAngle;
|
||||
App::PropertyAngle TaperAngle2;
|
||||
App::PropertyBool UseCustomVector;
|
||||
App::PropertyVector Direction;
|
||||
App::PropertyBool AlongSketchNormal;
|
||||
@@ -48,6 +52,8 @@ public:
|
||||
App::PropertyLinkSub ReferenceAxis;
|
||||
|
||||
static App::PropertyQuantityConstraint::Constraints signedLengthConstraint;
|
||||
static double maxAngle;
|
||||
static App::PropertyAngle::Constraints floatAngle;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
|
||||
@@ -75,6 +75,10 @@ Pad::Pad()
|
||||
ADD_PROPERTY_TYPE(UpToFace, (0), "Pad", App::Prop_None, "Face where pad will end");
|
||||
ADD_PROPERTY_TYPE(Offset, (0.0), "Pad", App::Prop_None, "Offset from face in which pad will end");
|
||||
Offset.setConstraints(&signedLengthConstraint);
|
||||
ADD_PROPERTY_TYPE(TaperAngle, (0.0), "Pad", App::Prop_None, "Taper angle");
|
||||
TaperAngle.setConstraints(&floatAngle);
|
||||
ADD_PROPERTY_TYPE(TaperAngle2, (0.0), "Pad", App::Prop_None, "Taper angle for 2nd direction");
|
||||
TaperAngle2.setConstraints(&floatAngle);
|
||||
|
||||
// Remove the constraints and keep the type to allow to accept negative values
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=3&t=52075&p=448410#p447636
|
||||
@@ -186,7 +190,7 @@ App::DocumentObjectExecReturn *Pad::execute()
|
||||
supportface = TopoDS_Face();
|
||||
|
||||
PrismMode mode = PrismMode::None;
|
||||
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
Extrude(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
base.Nullify();
|
||||
}
|
||||
else {
|
||||
@@ -203,12 +207,12 @@ App::DocumentObjectExecReturn *Pad::execute()
|
||||
if (!Ex.More())
|
||||
supportface = TopoDS_Face();
|
||||
PrismMode mode = PrismMode::None;
|
||||
generatePrism(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
Extrude(prism, method, base, sketchshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
}
|
||||
}
|
||||
else {
|
||||
generatePrism(prism, sketchshape, method, dir, L, L2,
|
||||
hasMidplane, hasReversed);
|
||||
Extrude(prism, sketchshape, method, dir, L, L2,
|
||||
TaperAngle.getValue(), TaperAngle2.getValue(), hasMidplane, hasReversed);
|
||||
}
|
||||
|
||||
if (prism.IsNull())
|
||||
|
||||
@@ -74,6 +74,10 @@ Pocket::Pocket()
|
||||
ADD_PROPERTY_TYPE(UpToFace, (0), "Pocket", App::Prop_None, "Face where pocket will end");
|
||||
ADD_PROPERTY_TYPE(Offset, (0.0), "Pocket", App::Prop_None, "Offset from face in which pocket will end");
|
||||
Offset.setConstraints(&signedLengthConstraint);
|
||||
ADD_PROPERTY_TYPE(TaperAngle, (0.0), "Pocket", App::Prop_None, "Taper angle");
|
||||
TaperAngle.setConstraints(&floatAngle);
|
||||
ADD_PROPERTY_TYPE(TaperAngle2, (0.0), "Pocket", App::Prop_None, "Taper angle for 2nd direction");
|
||||
TaperAngle2.setConstraints(&floatAngle);
|
||||
|
||||
// Remove the constraints and keep the type to allow to accept negative values
|
||||
// https://forum.freecadweb.org/viewtopic.php?f=3&t=52075&p=448410#p447636
|
||||
@@ -196,7 +200,7 @@ App::DocumentObjectExecReturn *Pocket::execute()
|
||||
supportface = TopoDS_Face();
|
||||
TopoDS_Shape prism;
|
||||
PrismMode mode = PrismMode::CutFromBase;
|
||||
generatePrism(prism, method, base, profileshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
Extrude(prism, method, base, profileshape, supportface, upToFace, dir, mode, Standard_True);
|
||||
|
||||
// And the really expensive way to get the SubShape...
|
||||
BRepAlgoAPI_Cut mkCut(base, prism);
|
||||
@@ -215,8 +219,8 @@ App::DocumentObjectExecReturn *Pocket::execute()
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape prism;
|
||||
generatePrism(prism, profileshape, method, dir, L, L2,
|
||||
Midplane.getValue(), Reversed.getValue());
|
||||
Extrude(prism, profileshape, method, dir, L, L2, TaperAngle.getValue(), TaperAngle2.getValue(),
|
||||
Midplane.getValue(), Reversed.getValue());
|
||||
|
||||
if (prism.IsNull())
|
||||
return new App::DocumentObjectExecReturn("Pocket: Resulting shape is empty");
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
# include <BRepBuilderAPI_Copy.hxx>
|
||||
# include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <BRepBuilderAPI_MakeWire.hxx>
|
||||
# include <BRepCheck_Analyzer.hxx>
|
||||
# include <BRepExtrema_DistShapeShape.hxx>
|
||||
# include <BRepGProp.hxx>
|
||||
@@ -42,6 +43,8 @@
|
||||
# include <BRepLProp_SLProps.hxx>
|
||||
# include <BRepPrimAPI_MakePrism.hxx>
|
||||
# include <BRepFeat_MakePrism.hxx>
|
||||
# include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
# include <BRepOffsetAPI_ThruSections.hxx>
|
||||
# include <BRepProj_Projection.hxx>
|
||||
# include <Extrema_ExtCC.hxx>
|
||||
# include <Extrema_POnCurv.hxx>
|
||||
@@ -73,9 +76,11 @@
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Document.h>
|
||||
#include <Mod/Part/App/ExtrusionHelper.h>
|
||||
#include <Mod/Part/App/FaceMakerCheese.h>
|
||||
#include "FeatureSketchBased.h"
|
||||
#include "DatumPlane.h"
|
||||
@@ -580,18 +585,21 @@ double ProfileBased::getThroughAllLength() const
|
||||
return 2.02 * sqrt(box.SquareExtent());
|
||||
}
|
||||
|
||||
void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& dir,
|
||||
const double L,
|
||||
const double L2,
|
||||
const bool midplane,
|
||||
const bool reversed)
|
||||
void ProfileBased::Extrude(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& direction,
|
||||
const double L,
|
||||
const double L2,
|
||||
const double angle,
|
||||
const double angle2,
|
||||
const bool midplane,
|
||||
const bool reversed)
|
||||
{
|
||||
if (method == "Length" || method == "TwoLengths" || method == "ThroughAll") {
|
||||
double Ltotal = L;
|
||||
double Loffset = 0.;
|
||||
gp_Dir directionTaper = direction;
|
||||
if (method == "ThroughAll")
|
||||
Ltotal = getThroughAllLength();
|
||||
|
||||
@@ -613,7 +621,7 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
TopoDS_Shape from = sketchshape;
|
||||
if (method == "TwoLengths" || midplane) {
|
||||
gp_Trsf mov;
|
||||
mov.SetTranslation(Loffset * gp_Vec(dir));
|
||||
mov.SetTranslation(Loffset * gp_Vec(direction));
|
||||
TopLoc_Location loc(mov);
|
||||
from = sketchshape.Moved(loc);
|
||||
}
|
||||
@@ -628,12 +636,25 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
throw Base::ValueError("Cannot create a pocket with a depth of zero.");
|
||||
}
|
||||
|
||||
// Its better not to use BRepFeat_MakePrism here even if we have a support because the
|
||||
// resulting shape creates problems with Pocket
|
||||
BRepPrimAPI_MakePrism PrismMaker(from, Ltotal * gp_Vec(dir), 0, 1); // finite prism
|
||||
if (!PrismMaker.IsDone())
|
||||
throw Base::RuntimeError("ProfileBased: Length: Could not extrude the sketch!");
|
||||
prism = PrismMaker.Shape();
|
||||
// now we can create either a tapered or linear prism.
|
||||
// If tapered, we create is using Part's draft extrusion method. If linear we create a prism.
|
||||
if (fabs(angle) > Base::toRadians(Precision::Angular()) || fabs(angle2) > Base::toRadians(Precision::Angular())) {
|
||||
// prism is tapered
|
||||
if (reversed)
|
||||
directionTaper.Reverse();
|
||||
generateTaperedPrism(prism, sketchshape, method, directionTaper, L, L2, angle, angle2, midplane);
|
||||
}
|
||||
else {
|
||||
// Without taper angle we create a prism because its shells are in every case no B-splines and can therefore
|
||||
// be use as support for further features like Pads, Lofts etc. B-spline shells can break certain features,
|
||||
// see e.g. https://forum.freecadweb.org/viewtopic.php?p=560785#p560785
|
||||
// It is better not to use BRepFeat_MakePrism here even if we have a support because the
|
||||
// resulting shape creates problems with Pocket
|
||||
BRepPrimAPI_MakePrism PrismMaker(from, Ltotal * gp_Vec(direction), 0, 1); // finite prism
|
||||
if (!PrismMaker.IsDone())
|
||||
throw Base::RuntimeError("ProfileBased: Length: Could not extrude the sketch!");
|
||||
prism = PrismMaker.Shape();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::stringstream str;
|
||||
@@ -641,18 +662,17 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
<< method << "' for generatePrism()";
|
||||
throw Base::RuntimeError(str.str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
const std::string& method,
|
||||
const TopoDS_Shape& baseshape,
|
||||
const TopoDS_Shape& profileshape,
|
||||
const TopoDS_Face& supportface,
|
||||
const TopoDS_Face& uptoface,
|
||||
const gp_Dir& direction,
|
||||
PrismMode Mode,
|
||||
Standard_Boolean Modify)
|
||||
void ProfileBased::Extrude(TopoDS_Shape& prism,
|
||||
const std::string& method,
|
||||
const TopoDS_Shape& baseshape,
|
||||
const TopoDS_Shape& profileshape,
|
||||
const TopoDS_Face& supportface,
|
||||
const TopoDS_Face& uptoface,
|
||||
const gp_Dir& direction,
|
||||
PrismMode Mode,
|
||||
Standard_Boolean Modify)
|
||||
{
|
||||
if (method == "UpToFirst" || method == "UpToFace" || method == "UpToLast") {
|
||||
BRepFeat_MakePrism PrismMaker;
|
||||
@@ -678,6 +698,51 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileBased::generateTaperedPrism(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& direction,
|
||||
const double L,
|
||||
const double L2,
|
||||
const double angle,
|
||||
const double angle2,
|
||||
const bool midplane)
|
||||
{
|
||||
std::list<TopoDS_Shape> drafts;
|
||||
bool isSolid = true; // in PD we only generate solids, while Part Extrude can also create only shells
|
||||
bool isPartDesign = true; // there is an OCC bug with single-edge wires (circles) we need to treat differently for PD and Part
|
||||
if (method == "ThroughAll")
|
||||
Part::ExtrusionHelper::makeDraft(sketchshape, direction, getThroughAllLength(),
|
||||
0.0, Base::toRadians(angle), 0.0, isSolid, drafts, isPartDesign);
|
||||
else if (method == "TwoLengths")
|
||||
Part::ExtrusionHelper::makeDraft(sketchshape, direction, L, L2,
|
||||
Base::toRadians(angle), Base::toRadians(angle2), isSolid, drafts, isPartDesign);
|
||||
else if (method == "Length") {
|
||||
if (midplane) {
|
||||
Part::ExtrusionHelper::makeDraft(sketchshape, direction, L / 2, L / 2,
|
||||
Base::toRadians(angle), Base::toRadians(angle), isSolid, drafts, isPartDesign);
|
||||
}
|
||||
else
|
||||
Part::ExtrusionHelper::makeDraft(sketchshape, direction, L, 0.0,
|
||||
Base::toRadians(angle), 0.0, isSolid, drafts, isPartDesign);
|
||||
}
|
||||
|
||||
if (drafts.empty()) {
|
||||
throw Base::RuntimeError("Creation of tapered object failed");
|
||||
}
|
||||
else if (drafts.size() == 1) {
|
||||
prism = drafts.front();
|
||||
}
|
||||
else {
|
||||
TopoDS_Compound comp;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound(comp);
|
||||
for (std::list<TopoDS_Shape>::iterator it = drafts.begin(); it != drafts.end(); ++it)
|
||||
builder.Add(comp, *it);
|
||||
prism = comp;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProfileBased::checkWireInsideFace(const TopoDS_Wire& wire, const TopoDS_Face& face,
|
||||
const gp_Dir& dir) {
|
||||
// Project wire onto the face (face, not surface! So limits of face apply)
|
||||
@@ -1034,7 +1099,6 @@ bool ProfileBased::isParallelPlane(const TopoDS_Shape & s1, const TopoDS_Shape &
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
double ProfileBased::getReversedAngle(const Base::Vector3d & b, const Base::Vector3d & v)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -143,28 +143,31 @@ protected:
|
||||
double offset);
|
||||
|
||||
/**
|
||||
* Generate a linear prism
|
||||
* It will be a stand-alone solid created with BRepPrimAPI_MakePrism
|
||||
* Generates an extrusion of the input sketchshape and stores it in the given &prism
|
||||
*/
|
||||
void generatePrism(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& direction,
|
||||
const double L,
|
||||
const double L2,
|
||||
const bool midplane,
|
||||
const bool reversed);
|
||||
void Extrude(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& direction,
|
||||
const double L,
|
||||
const double L2,
|
||||
const double angle,
|
||||
const double angle2,
|
||||
const bool midplane,
|
||||
const bool reversed);
|
||||
|
||||
// See BRepFeat_MakePrism
|
||||
enum PrismMode {
|
||||
CutFromBase = 0,
|
||||
FuseWithBase = 1,
|
||||
None = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a linear prism
|
||||
* Generates an extrusion of the input profileshape
|
||||
* It will be a stand-alone solid created with BRepFeat_MakePrism
|
||||
*/
|
||||
static void generatePrism(TopoDS_Shape& prism,
|
||||
static void Extrude(TopoDS_Shape& prism,
|
||||
const std::string& method,
|
||||
const TopoDS_Shape& baseshape,
|
||||
const TopoDS_Shape& profileshape,
|
||||
@@ -174,6 +177,19 @@ protected:
|
||||
PrismMode Mode,
|
||||
Standard_Boolean Modify);
|
||||
|
||||
/**
|
||||
* Generates a tapered prism of the input sketchshape and stores it in the given &prism
|
||||
*/
|
||||
void generateTaperedPrism(TopoDS_Shape& prism,
|
||||
const TopoDS_Shape& sketchshape,
|
||||
const std::string& method,
|
||||
const gp_Dir& direction,
|
||||
const double L,
|
||||
const double L2,
|
||||
const double angle,
|
||||
const double angle2,
|
||||
const bool midplane);
|
||||
|
||||
/// Check whether the wire after projection on the face is inside the face
|
||||
static bool checkWireInsideFace(const TopoDS_Wire& wire,
|
||||
const TopoDS_Face& face,
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
# include <BRepLProp_SLProps.hxx>
|
||||
# include <BRepProj_Projection.hxx>
|
||||
# include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
# include <BRepBuilderAPI_MakeWire.hxx>
|
||||
# include <BRepBuilderAPI_Sewing.hxx>
|
||||
# include <BRepBuilderAPI_MakePolygon.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
@@ -89,6 +90,7 @@
|
||||
# include <BRepExtrema_DistShapeShape.hxx>
|
||||
# include <BRepFilletAPI_MakeChamfer.hxx>
|
||||
# include <BRepOffsetAPI_DraftAngle.hxx>
|
||||
# include <BRepOffsetAPI_MakeOffset.hxx>
|
||||
# include <BRepOffsetAPI_ThruSections.hxx>
|
||||
# include <BRepPrimAPI_MakeBox.hxx>
|
||||
# include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
|
||||
@@ -73,6 +73,8 @@ void TaskExtrudeParameters::setupDialog()
|
||||
Base::Quantity l = extrude->Length.getQuantityValue();
|
||||
Base::Quantity l2 = extrude->Length2.getQuantityValue();
|
||||
Base::Quantity off = extrude->Offset.getQuantityValue();
|
||||
Base::Quantity taper = extrude->TaperAngle.getQuantityValue();
|
||||
Base::Quantity taper2 = extrude->TaperAngle2.getQuantityValue();
|
||||
|
||||
bool alongNormal = extrude->AlongSketchNormal.getValue();
|
||||
bool useCustom = extrude->UseCustomVector.getValue();
|
||||
@@ -107,6 +109,14 @@ void TaskExtrudeParameters::setupDialog()
|
||||
ui->lengthEdit->setValue(l);
|
||||
ui->lengthEdit2->setValue(l2);
|
||||
ui->offsetEdit->setValue(off);
|
||||
ui->taperEdit->setMinimum(extrude->TaperAngle.getMinimum());
|
||||
ui->taperEdit->setMaximum(extrude->TaperAngle.getMaximum());
|
||||
ui->taperEdit->setSingleStep(extrude->TaperAngle.getStepSize());
|
||||
ui->taperEdit->setValue(taper);
|
||||
ui->taperEdit2->setMinimum(extrude->TaperAngle2.getMinimum());
|
||||
ui->taperEdit2->setMaximum(extrude->TaperAngle2.getMaximum());
|
||||
ui->taperEdit2->setSingleStep(extrude->TaperAngle2.getStepSize());
|
||||
ui->taperEdit2->setValue(taper2);
|
||||
|
||||
ui->checkBoxAlongDirection->setChecked(alongNormal);
|
||||
ui->checkBoxDirection->setChecked(useCustom);
|
||||
@@ -126,6 +136,8 @@ void TaskExtrudeParameters::setupDialog()
|
||||
ui->lengthEdit->bind(extrude->Length);
|
||||
ui->lengthEdit2->bind(extrude->Length2);
|
||||
ui->offsetEdit->bind(extrude->Offset);
|
||||
ui->taperEdit->bind(extrude->TaperAngle);
|
||||
ui->taperEdit2->bind(extrude->TaperAngle2);
|
||||
ui->XDirectionEdit->bind(App::ObjectIdentifier::parse(extrude, std::string("Direction.x")));
|
||||
ui->YDirectionEdit->bind(App::ObjectIdentifier::parse(extrude, std::string("Direction.y")));
|
||||
ui->ZDirectionEdit->bind(App::ObjectIdentifier::parse(extrude, std::string("Direction.z")));
|
||||
@@ -172,6 +184,10 @@ void TaskExtrudeParameters::readValuesFromHistory()
|
||||
ui->lengthEdit2->selectNumber();
|
||||
ui->offsetEdit->setToLastUsedValue();
|
||||
ui->offsetEdit->selectNumber();
|
||||
ui->taperEdit->setToLastUsedValue();
|
||||
ui->taperEdit->selectNumber();
|
||||
ui->taperEdit2->setToLastUsedValue();
|
||||
ui->taperEdit2->selectNumber();
|
||||
}
|
||||
|
||||
void TaskExtrudeParameters::connectSlots()
|
||||
@@ -184,6 +200,10 @@ void TaskExtrudeParameters::connectSlots()
|
||||
this, SLOT(onLength2Changed(double)));
|
||||
connect(ui->offsetEdit, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onOffsetChanged(double)));
|
||||
connect(ui->taperEdit, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onTaperChanged(double)));
|
||||
connect(ui->taperEdit2, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onTaper2Changed(double)));
|
||||
connect(ui->directionCB, SIGNAL(activated(int)),
|
||||
this, SLOT(onDirectionCBChanged(int)));
|
||||
connect(ui->checkBoxAlongDirection, SIGNAL(toggled(bool)),
|
||||
@@ -292,6 +312,20 @@ void TaskExtrudeParameters::onOffsetChanged(double len)
|
||||
tryRecomputeFeature();
|
||||
}
|
||||
|
||||
void TaskExtrudeParameters::onTaperChanged(double angle)
|
||||
{
|
||||
PartDesign::FeatureExtrude* extrude = static_cast<PartDesign::FeatureExtrude*>(vp->getObject());
|
||||
extrude->TaperAngle.setValue(angle);
|
||||
tryRecomputeFeature();
|
||||
}
|
||||
|
||||
void TaskExtrudeParameters::onTaper2Changed(double angle)
|
||||
{
|
||||
PartDesign::FeatureExtrude* extrude = static_cast<PartDesign::FeatureExtrude*>(vp->getObject());
|
||||
extrude->TaperAngle2.setValue(angle);
|
||||
tryRecomputeFeature();
|
||||
}
|
||||
|
||||
bool TaskExtrudeParameters::hasProfileFace(PartDesign::ProfileBased* profile) const
|
||||
{
|
||||
try {
|
||||
@@ -769,6 +803,8 @@ void TaskExtrudeParameters::changeEvent(QEvent *e)
|
||||
QSignalBlocker length(ui->lengthEdit);
|
||||
QSignalBlocker length2(ui->lengthEdit2);
|
||||
QSignalBlocker offset(ui->offsetEdit);
|
||||
QSignalBlocker taper(ui->taperEdit);
|
||||
QSignalBlocker taper2(ui->taperEdit2);
|
||||
QSignalBlocker xdir(ui->XDirectionEdit);
|
||||
QSignalBlocker ydir(ui->YDirectionEdit);
|
||||
QSignalBlocker zdir(ui->ZDirectionEdit);
|
||||
@@ -804,6 +840,8 @@ void TaskExtrudeParameters::saveHistory(void)
|
||||
ui->lengthEdit->pushToHistory();
|
||||
ui->lengthEdit2->pushToHistory();
|
||||
ui->offsetEdit->pushToHistory();
|
||||
ui->taperEdit->pushToHistory();
|
||||
ui->taperEdit2->pushToHistory();
|
||||
}
|
||||
|
||||
void TaskExtrudeParameters::applyParameters(QString facename)
|
||||
@@ -812,6 +850,8 @@ void TaskExtrudeParameters::applyParameters(QString facename)
|
||||
|
||||
ui->lengthEdit->apply();
|
||||
ui->lengthEdit2->apply();
|
||||
ui->taperEdit->apply();
|
||||
ui->taperEdit2->apply();
|
||||
FCMD_OBJ_CMD(obj, "UseCustomVector = " << (getCustom() ? 1 : 0));
|
||||
FCMD_OBJ_CMD(obj, "Direction = ("
|
||||
<< getXDirection() << ", " << getYDirection() << ", " << getZDirection() << ")");
|
||||
|
||||
@@ -84,6 +84,8 @@ protected Q_SLOTS:
|
||||
void onLengthChanged(double);
|
||||
void onLength2Changed(double);
|
||||
void onOffsetChanged(double);
|
||||
void onTaperChanged(double);
|
||||
void onTaper2Changed(double);
|
||||
void onDirectionCBChanged(int);
|
||||
void onAlongSketchNormalChanged(bool);
|
||||
void onDirectionToggled(bool);
|
||||
@@ -104,13 +106,13 @@ protected:
|
||||
App::PropertyLinkSub* propReferenceAxis;
|
||||
void getReferenceAxis(App::DocumentObject*& obj, std::vector<std::string>& sub) const;
|
||||
|
||||
double getOffset(void) const;
|
||||
bool getAlongSketchNormal(void) const;
|
||||
bool getCustom(void) const;
|
||||
std::string getReferenceAxis(void) const;
|
||||
double getXDirection(void) const;
|
||||
double getYDirection(void) const;
|
||||
double getZDirection(void) const;
|
||||
double getOffset(void) const;
|
||||
bool getReversed(void) const;
|
||||
bool getMidplane(void) const;
|
||||
int getMode(void) const;
|
||||
|
||||
@@ -55,6 +55,10 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView, QWidget *parent,
|
||||
ui->lengthEdit2->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadLength2"));
|
||||
ui->offsetEdit->setEntryName(QByteArray("Offset"));
|
||||
ui->offsetEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadOffset"));
|
||||
ui->taperEdit->setEntryName(QByteArray("TaperAngle"));
|
||||
ui->taperEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadTaperAngle"));
|
||||
ui->taperEdit2->setEntryName(QByteArray("TaperAngle2"));
|
||||
ui->taperEdit2->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PadTaperAngle2"));
|
||||
|
||||
setupDialog();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>436</height>
|
||||
<height>490</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -44,6 +44,9 @@
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
@@ -61,6 +64,9 @@
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -258,6 +264,30 @@ measured along the specified direction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTaperAngle">
|
||||
<property name="toolTip">
|
||||
<string>Angle to taper the extrusion</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Taper angle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="taperEdit">
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
@@ -272,6 +302,33 @@ measured along the specified direction</string>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelTaperAngle2">
|
||||
<property name="toolTip">
|
||||
<string>Angle to taper the extrusion</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2nd taper angle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefQuantitySpinBox" name="taperEdit2">
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">deg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -56,6 +56,10 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
|
||||
ui->lengthEdit2->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PocketLength2"));
|
||||
ui->offsetEdit->setEntryName(QByteArray("Offset"));
|
||||
ui->offsetEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PocketOffset"));
|
||||
ui->taperEdit->setEntryName(QByteArray("TaperAngle"));
|
||||
ui->taperEdit->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PocketTaperAngle"));
|
||||
ui->taperEdit2->setEntryName(QByteArray("TaperAngle2"));
|
||||
ui->taperEdit2->setParamGrpPath(QByteArray("User parameter:BaseApp/History/PocketTaperAngle2"));
|
||||
|
||||
setupDialog();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user