improve error messages for Pocket, Hole and Groove feature

This commit is contained in:
wmayer
2018-12-31 18:30:13 +01:00
parent fd9516e071
commit 563d020b67
4 changed files with 37 additions and 7 deletions

View File

@@ -51,6 +51,7 @@
# include <Standard_Version.hxx>
#endif
#include <QCoreApplication>
#include <Base/Placement.h>
#include <Base/Exception.h>
#include <Base/Tools.h>
@@ -62,6 +63,8 @@
using namespace PartDesign;
/* TRANSLATOR PartDesign::Hole */
const char* Hole::DepthTypeEnums[] = { "Dimension", "ThroughAll", /*, "UpToFirst", */ NULL };
const char* Hole::ThreadTypeEnums[] = { "None", "ISOMetricProfile", "ISOMetricFineProfile", "UNC", "UNF", "UNEF", NULL};
const char* Hole::ThreadFitEnums[] = { "Standard", "Close", NULL};
@@ -948,8 +951,13 @@ App::DocumentObjectExecReturn *Hole::execute(void)
TopoDS_Shape base;
try {
base = getBaseShape();
} catch (const Base::Exception&) {
return new App::DocumentObjectExecReturn("No sketch support and no base shape: Please tell me where to remove the material of the hole!");
}
catch (const Base::Exception&) {
std::string text(QT_TR_NOOP("The requested feature cannot be created. The reason may be that:\n\n"
" \xe2\x80\xa2 the active Body does not contain a base shape, so there is no\n"
" material to be removed;\n"
" \xe2\x80\xa2 the selected sketch does not belong to the active Body."));
return new App::DocumentObjectExecReturn(text);
}
try {