0000479: Pad: negative value is not allowed

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5249 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer 2011-12-10 12:12:37 +00:00
parent b9a07509d4
commit 847a9aad5e
2 changed files with 8 additions and 1 deletions

View File

@ -38,6 +38,7 @@
# include <TopoDS_Wire.hxx>
# include <TopExp_Explorer.hxx>
# include <BRepAlgoAPI_Fuse.hxx>
# include <Precision.hxx>
#endif
#include <Base/Placement.h>
@ -74,6 +75,9 @@ short Pad::mustExecute() const
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");
@ -120,7 +124,7 @@ App::DocumentObjectExecReturn *Pad::execute(void)
return new App::DocumentObjectExecReturn("Creating a face from sketch failed");
// lengthen the vector
SketchOrientationVector *= Length.getValue();
SketchOrientationVector *= L;
try {
// extrude the face to a solid

View File

@ -71,6 +71,7 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
bool mirrored = pcPad->MirroredExtent.getValue();
bool reversed = pcPad->Reversed.getValue();
ui->doubleSpinBox->setMinimum(0);
ui->doubleSpinBox->setValue(l);
ui->doubleSpinBox->selectAll();
ui->checkBoxMirrored->setChecked(mirrored);
@ -184,6 +185,8 @@ bool TaskDlgPadParameters::accept()
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.recompute()");
if (!PadView->getObject()->isValid())
throw Base::Exception(PadView->getObject()->getStatusString());
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
Gui::Command::commitCommand();
}