From 0ddff2419faaff105b379d90ad31d483e845dbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Rheinl=C3=A4nder?= Date: Mon, 19 May 2014 21:43:59 +0200 Subject: [PATCH] Fixed bugs in Transformed features --- src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp | 5 +++-- src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp | 5 +++-- src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp | 10 +++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp index 0a560e66c..efdfd5fb1 100644 --- a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp @@ -462,10 +462,11 @@ void TaskLinearPatternParameters::apply() App::DocumentObject* obj; getDirection(obj, directions); std::string direction = getPythonStr(obj, directions); - if (!direction.empty()) { + if (!direction.empty() && obj) { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = %s", name.c_str(), direction.c_str()); - } else + } else { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = None", name.c_str()); + } Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),getReverse()); ui->spinLength->apply(); diff --git a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp index 7ef750785..9052298b8 100644 --- a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp @@ -393,10 +393,11 @@ bool TaskDlgMirroredParameters::accept() App::DocumentObject* obj; mirrorParameter->getMirrorPlane(obj, mirrorPlanes); std::string mirrorPlane = getPythonStr(obj, mirrorPlanes); - if (!mirrorPlane.empty()) { + if (!mirrorPlane.empty() && obj) { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirrorPlane = %s", name.c_str(), mirrorPlane.c_str()); - } else + } else { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirrorPlane = None", name.c_str()); + } Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); if (!TransformedView->getObject()->isValid()) throw Base::Exception(TransformedView->getObject()->getStatusString()); diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp index 2adaa8027..8d9910fc0 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp @@ -385,11 +385,15 @@ void TaskPolarPatternParameters::changeEvent(QEvent *e) void TaskPolarPatternParameters::apply() { std::string name = TransformedView->getObject()->getNameInDocument(); - std::string axis = getAxis(); - if (!axis.empty()) { + std::vector axes; + App::DocumentObject* obj; + getAxis(obj, axes); + std::string axis = getPythonStr(obj, axes); + if (!axis.empty() && obj) { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = %s", name.c_str(), axis.c_str()); - } else + } else { Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = None", name.c_str()); + } Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),getReverse()); ui->polarAngle->apply(); ui->spinOccurrences->apply();