From b868dbbe7f1bdb5c0759f06e80f00b732d603437 Mon Sep 17 00:00:00 2001 From: donovaly Date: Tue, 6 Apr 2021 03:26:19 +0200 Subject: [PATCH] small fixes as suggested by @chennes therefore also in the helix code --- src/Mod/PartDesign/App/FeaturePad.cpp | 2 +- src/Mod/PartDesign/Gui/TaskHelixParameters.cpp | 6 ++++-- src/Mod/PartDesign/Gui/TaskPadParameters.cpp | 9 +++++---- src/Mod/PartDesign/Gui/TaskPadParameters.ui | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Mod/PartDesign/App/FeaturePad.cpp b/src/Mod/PartDesign/App/FeaturePad.cpp index a510922958..35755a212a 100644 --- a/src/Mod/PartDesign/App/FeaturePad.cpp +++ b/src/Mod/PartDesign/App/FeaturePad.cpp @@ -147,7 +147,7 @@ App::DocumentObjectExecReturn *Pad::execute(void) Base::Vector3d paddingDirection; if (!UseCustomVector.getValue()) { - if (ReferenceAxis.getValue() == 0) { + if (ReferenceAxis.getValue() == nullptr) { // use sketch's normal vector for direction paddingDirection = SketchVector; AlongSketchNormal.setReadOnly(true); diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp index eeb1e6bb83..029a63c661 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp @@ -235,8 +235,10 @@ void TaskHelixParameters::fillAxisCombo(bool forceRefill) App::DocumentObject* ax = propReferenceAxis->getValue(); const std::vector &subList = propReferenceAxis->getSubValues(); for (size_t i = 0; i < axesInList.size(); i++) { - if (ax == axesInList[i]->getValue() && subList == axesInList[i]->getSubValues()) + if (ax == axesInList[i]->getValue() && subList == axesInList[i]->getSubValues()) { indexOfCurrent = i; + break; + } } if (indexOfCurrent == -1 && ax) { assert(subList.size() <= 1); @@ -260,7 +262,7 @@ void TaskHelixParameters::addAxisToCombo(App::DocumentObject* linkObj, { this->ui->axis->addItem(itemText); this->axesInList.emplace_back(new App::PropertyLinkSub); - App::PropertyLinkSub &lnk = *(axesInList[axesInList.size()-1]); + App::PropertyLinkSub &lnk = *(axesInList.back()); lnk.setValue(linkObj,std::vector(1,linkSubname)); } diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index 76a71fdf88..3ec5d37bf9 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -370,8 +370,10 @@ void TaskPadParameters::fillDirectionCombo() App::DocumentObject* ax = propReferenceAxis->getValue(); const std::vector& subList = propReferenceAxis->getSubValues(); for (size_t i = 0; i < axesInList.size(); i++) { - if (ax == axesInList[i]->getValue() && subList == axesInList[i]->getSubValues()) + if (ax == axesInList[i]->getValue() && subList == axesInList[i]->getSubValues()) { indexOfCurrent = i; + break; + } } if (indexOfCurrent == -1 && ax) { assert(subList.size() <= 1); @@ -400,7 +402,7 @@ void TaskPadParameters::addAxisToCombo(App::DocumentObject* linkObj, { this->ui->directionCB->addItem(itemText); this->axesInList.emplace_back(new App::PropertyLinkSub); - App::PropertyLinkSub& lnk = *(axesInList[axesInList.size() - 1]); + App::PropertyLinkSub& lnk = *(axesInList.back()); lnk.setValue(linkObj, std::vector(1, linkSubname)); } @@ -636,8 +638,7 @@ std::string TaskPadParameters::getReferenceAxis(void) const std::vector sub; App::DocumentObject* obj; getReferenceAxis(obj, sub); - std::string axis = buildLinkSingleSubPythonStr(obj, sub); - return axis; + return buildLinkSingleSubPythonStr(obj, sub); } double TaskPadParameters::getXDirection(void) const diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.ui b/src/Mod/PartDesign/Gui/TaskPadParameters.ui index f0ceff6075..d162b248e0 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.ui @@ -92,7 +92,7 @@ or select an edge as reference true - Use custom vector for pad direction otherwise + Use custom vector for pad direction, otherwise the sketch plane's normal vector will be used