diff --git a/src/Mod/PartDesign/App/FeaturePad.cpp b/src/Mod/PartDesign/App/FeaturePad.cpp index 32fe24d61..0dab92b69 100644 --- a/src/Mod/PartDesign/App/FeaturePad.cpp +++ b/src/Mod/PartDesign/App/FeaturePad.cpp @@ -38,6 +38,7 @@ # include # include # include +# include #endif #include @@ -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 diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index 3b07046b6..15372ad85 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -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(); }