diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 9fd33b247..6f4b5371e 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -133,7 +133,7 @@ bool LoftWidget::accept() int count = d->ui.selector->selectedTreeWidget()->topLevelItemCount(); if (count < 2) { - QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices, edges, wires or Faces are required.")); + QMessageBox::critical(this, tr("Too few elements"), tr("At least two vertices, edges, wires or faces are required.")); return false; } for (int i=0; iopenCommand("Loft"); Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); - doc->commitCommand(); doc->getDocument()->recompute(); + App::DocumentObject* obj = doc->getDocument()->getActiveObject(); + if (obj && !obj->isValid()) { + std::string msg = obj->getStatusString(); + doc->abortCommand(); + throw Base::Exception(msg); + } + doc->commitCommand(); } catch (const Base::Exception& e) { - Base::Console().Error("%s\n", e.what()); + QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); return false; } diff --git a/src/Mod/Part/Gui/TaskSweep.cpp b/src/Mod/Part/Gui/TaskSweep.cpp index 9d0141ef3..fb1c899ab 100644 --- a/src/Mod/Part/Gui/TaskSweep.cpp +++ b/src/Mod/Part/Gui/TaskSweep.cpp @@ -182,11 +182,17 @@ bool SweepWidget::accept() if (!doc) throw Base::Exception("Document doesn't exist anymore"); doc->openCommand("Sweep"); Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); - doc->commitCommand(); doc->getDocument()->recompute(); + App::DocumentObject* obj = doc->getDocument()->getActiveObject(); + if (obj && !obj->isValid()) { + std::string msg = obj->getStatusString(); + doc->abortCommand(); + throw Base::Exception(msg); + } + doc->commitCommand(); } catch (const Base::Exception& e) { - Base::Console().Error("%s\n", e.what()); + QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); return false; }