PartDesign/Feature: add an optional parameter to getBaseObject() to prevent it from throwing exceptions
In most cases getBaseObject() is used with an exception handler which only detects if it failed but not the reason. This modification allows to use it without excess exception handlers. Also add the same parameter to SketchBased::getVerifiedSketch().
This commit is contained in:
committed by
Stefan Tröger
parent
bba3733086
commit
af385f1c57
@@ -59,11 +59,11 @@ bool TaskDlgFeatureParameters::accept() {
|
||||
throw Base::Exception("Bad object processed in the feature dialog.");
|
||||
}
|
||||
|
||||
App::DocumentObject* support = static_cast<PartDesign::Feature*>(feature)->BaseFeature.getValue();
|
||||
App::DocumentObject* previous = static_cast<PartDesign::Feature*>(feature)->getBaseObject(/* silent = */ true );
|
||||
|
||||
if (support) {
|
||||
if (previous) {
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().hide(\"%s\")",
|
||||
support->getNameInDocument());
|
||||
previous->getNameInDocument());
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||
@@ -91,12 +91,7 @@ bool TaskDlgFeatureParameters::reject()
|
||||
|
||||
// Find out previous feature we won't be able to do it after abort
|
||||
// (at least in the body case)
|
||||
App::DocumentObject* previous;
|
||||
try {
|
||||
previous = feature->getBaseObject(); // throws on errors
|
||||
} catch (const Base::Exception &ex) {
|
||||
previous = 0;
|
||||
}
|
||||
App::DocumentObject* previous = feature->getBaseObject(/* silent = */ true );
|
||||
|
||||
// roll back the done things
|
||||
Gui::Command::abortCommand();
|
||||
|
||||
Reference in New Issue
Block a user