PD: fix several issues in pad:

* pass boolean instead of int to setValue of PropertyBool
* support of symmetric option for two-length mode
* fix bug in TaskPadParameters::updateUI()
* remove strange acronyms from method names
This commit is contained in:
wmayer
2021-03-22 16:40:15 +01:00
parent 2d447d2560
commit 09f93b2e8d
4 changed files with 16 additions and 14 deletions

View File

@@ -70,7 +70,7 @@ Pad::Pad()
ADD_PROPERTY_TYPE(Length2, (100.0), "Pad", App::Prop_None,"Second Pad length");
ADD_PROPERTY_TYPE(UseCustomVector, (0), "Pad", App::Prop_None, "Use custom vector for pad direction");
ADD_PROPERTY_TYPE(Direction, (Base::Vector3d(1.0, 1.0, 1.0)), "Pad", App::Prop_None, "Pad direction vector");
ADD_PROPERTY_TYPE(AlongCustomVector, (1), "Pad", App::Prop_None, "Measure length along custom direction vector");
ADD_PROPERTY_TYPE(AlongCustomVector, (true), "Pad", App::Prop_None, "Measure length along custom direction vector");
ADD_PROPERTY_TYPE(UpToFace, (0), "Pad", App::Prop_None, "Face where pad will end");
ADD_PROPERTY_TYPE(Offset, (0.0), "Pad", App::Prop_None, "Offset from face in which pad will end");
static const App::PropertyQuantityConstraint::Constraints signedLengthConstraint = {-DBL_MAX, DBL_MAX, 1.0};

View File

@@ -590,6 +590,8 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
Ltotal += L2;
if (reversed)
Loffset = -L;
else if (midplane)
Loffset = -0.5 * (L2 + L);
else
Loffset = -L2;
} else if (midplane)

View File

@@ -157,9 +157,9 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView, QWidget *parent,
connect(ui->lengthEdit2, SIGNAL(valueChanged(double)),
this, SLOT(onLength2Changed(double)));
connect(ui->checkBoxAlongDirection, SIGNAL(toggled(bool)),
this, SLOT(onCBAlongDirectionChanged(bool)));
this, SLOT(onAlongDirectionChanged(bool)));
connect(ui->groupBoxDirection, SIGNAL(toggled(bool)),
this, SLOT(onGBDirectionChanged(bool)));
this, SLOT(onDirectionToggled(bool)));
connect(ui->XDirectionEdit, SIGNAL(valueChanged(double)),
this, SLOT(onXDirectionEditChanged(double)));
connect(ui->YDirectionEdit, SIGNAL(valueChanged(double)),
@@ -204,8 +204,8 @@ void TaskPadParameters::updateUI(int index)
bool isLengthEdit2Visible = false;
bool isOffsetEditVisible = false;
bool isMidplateEnabled = false;
bool isReversedEnabled = true;
bool isReversedVisible = true;
bool isReversedEnabled = false;
bool isReversedVisible = false;
bool isFaceEditEnabled = false;
// dimension
@@ -216,22 +216,19 @@ void TaskPadParameters::updateUI(int index)
// Calling setFocus() directly doesn't work because the spin box is not
// yet visible.
QMetaObject::invokeMethod(ui->lengthEdit, "setFocus", Qt::QueuedConnection);
isMidplateEnabled = true;
isMidplateEnabled = !ui->checkBoxReversed->isChecked();
// Reverse only makes sense if Midplane is not true
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
isReversedVisible = true;
}
// up to first/last
else if (index == 1 || index == 2) {
isOffsetEditVisible = true;
isReversedEnabled = false;
isReversedVisible = false;
}
// up to face
else if (index == 3) {
isOffsetEditVisible = true;
isFaceEditEnabled = true;
isReversedEnabled = false;
isReversedVisible = false;
QMetaObject::invokeMethod(ui->lineFaceName, "setFocus", Qt::QueuedConnection);
// Go into reference selection mode if no face has been selected yet
if (ui->lineFaceName->property("FeatureName").isNull())
@@ -241,6 +238,9 @@ void TaskPadParameters::updateUI(int index)
else {
isLengthEditVisible = true;
isLengthEdit2Visible = true;
isMidplateEnabled = !ui->checkBoxReversed->isChecked();
isReversedEnabled = !ui->checkBoxMidplane->isChecked();
isReversedVisible = true;
}
ui->lengthEdit->setVisible( isLengthEditVisible );
@@ -310,14 +310,14 @@ void TaskPadParameters::onLength2Changed(double len)
recomputeFeature();
}
void TaskPadParameters::onCBAlongDirectionChanged(bool on)
void TaskPadParameters::onAlongDirectionChanged(bool on)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(vp->getObject());
pcPad->AlongCustomVector.setValue(on);
recomputeFeature();
}
void TaskPadParameters::onGBDirectionChanged(bool on)
void TaskPadParameters::onDirectionToggled(bool on)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(vp->getObject());
pcPad->UseCustomVector.setValue(on);

View File

@@ -58,8 +58,8 @@ public:
private Q_SLOTS:
void onLengthChanged(double);
void onLength2Changed(double);
void onCBAlongDirectionChanged(bool);
void onGBDirectionChanged(bool);
void onAlongDirectionChanged(bool);
void onDirectionToggled(bool);
void onXDirectionEditChanged(double);
void onYDirectionEditChanged(double);
void onZDirectionEditChanged(double);