[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

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