[PD] better solution for reversed pad/pocket handling

- let FeatureExtrude set the right direction
- use the UI as once intended: custom vector values are always taken as they are, so reversing a custom direction will not lead to a negation of the custom vector in the UI. The logic is: "take the vector as it is, and when Reversed is on, negate it additionally"
This commit is contained in:
Uwe
2021-11-23 04:22:37 +01:00
parent 165a09b3ed
commit a09e18b3bb
5 changed files with 26 additions and 29 deletions

View File

@@ -551,23 +551,16 @@ void TaskPadParameters::onZDirectionEditChanged(double len)
updateDirectionEdits();
}
void TaskPadParameters::updateDirectionEdits(bool Reversed)
void TaskPadParameters::updateDirectionEdits()
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(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);
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->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);
@@ -595,9 +588,10 @@ void TaskPadParameters::onReversedChanged(bool on)
pcPad->Reversed.setValue(on);
// midplane is not sensible when reversed
ui->checkBoxMidplane->setEnabled(!on);
recomputeFeature();
// update the direction
updateDirectionEdits(on);
recomputeFeature();
updateDirectionEdits();
}
void TaskPadParameters::onModeChanged(int index)