diff --git a/src/Mod/PartDesign/App/FeatureMirrored.cpp b/src/Mod/PartDesign/App/FeatureMirrored.cpp index d582677fb0..9956823c68 100644 --- a/src/Mod/PartDesign/App/FeatureMirrored.cpp +++ b/src/Mod/PartDesign/App/FeatureMirrored.cpp @@ -69,15 +69,15 @@ const std::list Mirrored::getTransformations(const std::vector(refObject)) { Base::Axis axis; - if (subStrings[0] == "H_Axis") { + if (subStrings.empty() || subStrings[0].empty()) { + axis = refSketch->getAxis(Part::Part2DObject::N_Axis); + } + else if (subStrings[0] == "H_Axis") { axis = refSketch->getAxis(Part::Part2DObject::V_Axis); } else if (subStrings[0] == "V_Axis") { axis = refSketch->getAxis(Part::Part2DObject::H_Axis); } - else if (subStrings[0].empty()) { - axis = refSketch->getAxis(Part::Part2DObject::N_Axis); - } else if (subStrings[0].compare(0, 4, "Axis") == 0) { int AxId = std::atoi(subStrings[0].substr(4,4000).c_str()); if (AxId >= 0 && AxId < refSketch->getAxisCount()) { @@ -85,6 +85,9 @@ const std::list Mirrored::getTransformations(const std::vectorPlacement.getValue(); axbase = gp_Pnt(axis.getBase().x, axis.getBase().y, axis.getBase().z); @@ -131,6 +134,9 @@ const std::list Mirrored::getTransformations(const std::vector subStrings = MirrorPlane.getSubValues(); if (auto feature = dynamic_cast(refObject)) { + if (subStrings.empty()) { + throw Base::ValueError("No mirror plane reference specified"); + } if (subStrings[0].empty()) { throw Base::ValueError("No direction reference specified"); } @@ -162,10 +168,6 @@ const std::list Mirrored::getTransformations(const std::vector subStrings = MirrorPlane.getSubValues(); - if (subStrings.empty()) { - throw Base::ValueError("No mirror plane reference specified"); - } gp_Pnt axbase; gp_Dir axdir; diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index 3e0788dae7..d5b2306de6 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -183,9 +183,13 @@ App::DocumentObjectExecReturn *Transformed::execute() try { std::list t_list = getTransformations(originals); transformations.insert(transformations.end(), t_list.begin(), t_list.end()); - } catch (Base::Exception& e) { + } + catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); } + catch (const Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); + } if (transformations.empty()) return App::DocumentObject::StdReturn; // No transformations defined, exit silently