diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index b7615e2b1f..1d6cbf128d 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -474,13 +474,6 @@ void TaskPadParameters::onDirectionCBChanged(int num) // in case the user is in selection mode, but changed his mind before selecting anything exitSelectionMode(); - try { - recomputeFeature(); - } - catch (const Base::Exception& e) { - e.ReportException(); - } - // disable AlongSketchNormal when the direction is already normal if (num == 0) ui->checkBoxAlongDirection->setEnabled(false); @@ -492,7 +485,6 @@ void TaskPadParameters::onDirectionCBChanged(int num) pcPad->UseCustomVector.setValue(true); } else { - ui->checkBoxDirection->setChecked(false); pcPad->UseCustomVector.setValue(false); } // if we dont use custom direction, only allow to show its direction @@ -507,7 +499,13 @@ void TaskPadParameters::onDirectionCBChanged(int num) ui->ZDirectionEdit->setEnabled(true); } // recompute and update the direction - recomputeFeature(); + pcPad->ReferenceAxis.setValue(lnk.getValue(), lnk.getSubValues()); + try { + recomputeFeature(); + } + catch (const Base::Exception& e) { + e.ReportException(); + } updateDirectionEdits(); } @@ -531,7 +529,7 @@ void TaskPadParameters::onXDirectionEditChanged(double len) PartDesign::Pad* pcPad = static_cast(vp->getObject()); pcPad->Direction.setValue(len, pcPad->Direction.getValue().y, pcPad->Direction.getValue().z); recomputeFeature(); - // checking for case of a null vector is done in FeaturePad.cpp + // checking for case of a null vector is done in FeatureExtrude.cpp // if there was a null vector, the normal vector of the sketch is used. // therefore the vector component edits must be updated updateDirectionEdits(); @@ -553,16 +551,23 @@ void TaskPadParameters::onZDirectionEditChanged(double len) updateDirectionEdits(); } -void TaskPadParameters::updateDirectionEdits(void) +void TaskPadParameters::updateDirectionEdits(bool Reversed) { PartDesign::Pad* pcPad = static_cast(vp->getObject()); // we don't want to execute the onChanged edits, but just update their contents ui->XDirectionEdit->blockSignals(true); ui->YDirectionEdit->blockSignals(true); ui->ZDirectionEdit->blockSignals(true); - ui->XDirectionEdit->setValue(pcPad->Direction.getValue().x); - ui->YDirectionEdit->setValue(pcPad->Direction.getValue().y); - ui->ZDirectionEdit->setValue(pcPad->Direction.getValue().z); + if (Reversed) { + ui->XDirectionEdit->setValue(-1 * pcPad->Direction.getValue().x); + ui->YDirectionEdit->setValue(-1 * pcPad->Direction.getValue().y); + ui->ZDirectionEdit->setValue(-1 * pcPad->Direction.getValue().z); + } + else { + ui->XDirectionEdit->setValue(pcPad->Direction.getValue().x); + ui->YDirectionEdit->setValue(pcPad->Direction.getValue().y); + ui->ZDirectionEdit->setValue(pcPad->Direction.getValue().z); + } ui->XDirectionEdit->blockSignals(false); ui->YDirectionEdit->blockSignals(false); ui->ZDirectionEdit->blockSignals(false); @@ -592,7 +597,7 @@ void TaskPadParameters::onReversedChanged(bool on) ui->checkBoxMidplane->setEnabled(!on); recomputeFeature(); // update the direction - updateDirectionEdits(); + updateDirectionEdits(on); } void TaskPadParameters::onModeChanged(int index) diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.h b/src/Mod/PartDesign/Gui/TaskPadParameters.h index 174fe43fad..54f6ca1d77 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.h @@ -96,7 +96,7 @@ private: QString getFaceName(void) const; void onSelectionChanged(const Gui::SelectionChanges& msg) override; void updateUI(int index); - void updateDirectionEdits(void); + void updateDirectionEdits(bool Reversed = false); private: QWidget* proxy; diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp index 016d4c9aa2..d7df987fac 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.cpp @@ -478,13 +478,6 @@ void TaskPocketParameters::onDirectionCBChanged(int num) // in case the user is in selection mode, but changed his mind before selecting anything exitSelectionMode(); - try { - recomputeFeature(); - } - catch (const Base::Exception& e) { - e.ReportException(); - } - // disable AlongSketchNormal when the direction is already normal if (num == 0) ui->checkBoxAlongDirection->setEnabled(false); @@ -497,7 +490,6 @@ void TaskPocketParameters::onDirectionCBChanged(int num) pcPocket->UseCustomVector.setValue(true); } else { - ui->checkBoxDirection->setChecked(false); pcPocket->UseCustomVector.setValue(false); } // if we dont use custom direction, only allow to show its direction @@ -512,7 +504,13 @@ void TaskPocketParameters::onDirectionCBChanged(int num) ui->ZDirectionEdit->setEnabled(true); } // recompute and update the direction - recomputeFeature(); + pcPocket->ReferenceAxis.setValue(lnk.getValue(), lnk.getSubValues()); + try { + recomputeFeature(); + } + catch (const Base::Exception& e) { + e.ReportException(); + } updateDirectionEdits(); } @@ -536,7 +534,7 @@ void TaskPocketParameters::onXDirectionEditChanged(double len) PartDesign::Pocket* pcPocket = static_cast(vp->getObject()); pcPocket->Direction.setValue(len, pcPocket->Direction.getValue().y, pcPocket->Direction.getValue().z); recomputeFeature(); - // checking for case of a null vector is done in FeaturePocket.cpp + // checking for case of a null vector is done in FeatureExtrude.cpp // if there was a null vector, the normal vector of the sketch is used. // therefore the vector component edits must be updated updateDirectionEdits(); @@ -558,16 +556,23 @@ void TaskPocketParameters::onZDirectionEditChanged(double len) updateDirectionEdits(); } -void TaskPocketParameters::updateDirectionEdits(void) +void TaskPocketParameters::updateDirectionEdits(bool Reversed) { PartDesign::Pocket* pcPocket = static_cast(vp->getObject()); // we don't want to execute the onChanged edits, but just update their contents ui->XDirectionEdit->blockSignals(true); ui->YDirectionEdit->blockSignals(true); ui->ZDirectionEdit->blockSignals(true); - ui->XDirectionEdit->setValue(pcPocket->Direction.getValue().x); - ui->YDirectionEdit->setValue(pcPocket->Direction.getValue().y); - ui->ZDirectionEdit->setValue(pcPocket->Direction.getValue().z); + if (Reversed) { + ui->XDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().x); + ui->YDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().y); + ui->ZDirectionEdit->setValue(-1 * pcPocket->Direction.getValue().z); + } + else { + ui->XDirectionEdit->setValue(pcPocket->Direction.getValue().x); + ui->YDirectionEdit->setValue(pcPocket->Direction.getValue().y); + ui->ZDirectionEdit->setValue(pcPocket->Direction.getValue().z); + } ui->XDirectionEdit->blockSignals(false); ui->YDirectionEdit->blockSignals(false); ui->ZDirectionEdit->blockSignals(false); @@ -585,7 +590,11 @@ void TaskPocketParameters::onReversedChanged(bool on) { PartDesign::Pocket* pcPocket = static_cast(vp->getObject()); pcPocket->Reversed.setValue(on); + // midplane is not sensible when reversed + ui->checkBoxMidplane->setEnabled(!on); recomputeFeature(); + // update the direction + updateDirectionEdits(on); } void TaskPocketParameters::onModeChanged(int index) diff --git a/src/Mod/PartDesign/Gui/TaskPocketParameters.h b/src/Mod/PartDesign/Gui/TaskPocketParameters.h index db6e8abdef..1b57c3061b 100644 --- a/src/Mod/PartDesign/Gui/TaskPocketParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPocketParameters.h @@ -97,7 +97,7 @@ private: void onSelectionChanged(const Gui::SelectionChanges& msg) override; void updateUI(int index); - void updateDirectionEdits(void); + void updateDirectionEdits(bool Reversed = false); private: QWidget* proxy;