From bd99fbdd3373d4c7c41dde8f937473da53006dd9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 3 Sep 2013 15:47:02 +0200 Subject: [PATCH] 0001051: Vertex in Part Loft and Sweep profile list - error handling --- src/Mod/Part/Gui/TaskLoft.cpp | 12 +++++++++--- src/Mod/Part/Gui/TaskSweep.cpp | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 9fd33b247a..6f4b5371e7 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 9d0141ef36..fb1c899abe 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; }