Pad/Pocket: Fixed bug that led to failed UpToFace when finishing the feature (thanks to wmayer for pointing this out)
This commit is contained in:
parent
0f6365ee4a
commit
44f15d5868
|
@ -97,10 +97,10 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
|
|||
double l2 = pcPad->Length2.getValue();
|
||||
int index = pcPad->Type.getValue(); // must extract value here, clear() kills it!
|
||||
std::vector<std::string> subStrings = pcPad->UpToFace.getSubValues();
|
||||
std::string upToFace;
|
||||
std::string upToFace;
|
||||
int faceId = -1;
|
||||
if (!subStrings.empty()) {
|
||||
upToFace = subStrings.front();
|
||||
if (!subStrings.empty()) {
|
||||
upToFace = subStrings.front();
|
||||
if (upToFace.substr(0,4) == "Face")
|
||||
faceId = std::atoi(&upToFace[4]);
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView,QWidget *parent)
|
|||
// According to bug #0000521 the reversed option
|
||||
// shouldn't be de-activated if the pad has a support face
|
||||
ui->checkBoxReversed->setChecked(reversed);
|
||||
ui->lineFaceName->setText(faceId >= 0 ?
|
||||
tr("Face") + QString::number(faceId) :
|
||||
ui->lineFaceName->setText(faceId >= 0 ?
|
||||
tr("Face") + QString::number(faceId) :
|
||||
tr("No face selected"));
|
||||
ui->lineFaceName->setProperty("FaceName", QByteArray(upToFace.c_str()));
|
||||
ui->changeMode->clear();
|
||||
|
@ -212,7 +212,7 @@ void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
}
|
||||
if (strcmp(msg.pObjectName, support->getNameInDocument()) != 0)
|
||||
return;
|
||||
|
||||
|
||||
std::vector<std::string> upToFaces(1,subName);
|
||||
pcPad->UpToFace.setValue(support, upToFaces);
|
||||
if (updateView())
|
||||
|
@ -228,7 +228,7 @@ void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
ui->lineFaceName->blockSignals(true);
|
||||
ui->lineFaceName->setText(tr("No face selected"));
|
||||
ui->lineFaceName->setProperty("FaceName", QByteArray());
|
||||
ui->lineFaceName->blockSignals(false);
|
||||
ui->lineFaceName->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ void TaskPadParameters::onButtonFace(const bool pressed) {
|
|||
doc->setShow(support->getNameInDocument());
|
||||
}
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelectionGate
|
||||
Gui::Selection().addSelectionGate
|
||||
(new ReferenceSelection(support, false, true, false));
|
||||
} else {
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
@ -351,7 +351,7 @@ void TaskPadParameters::onUpdateView(bool on)
|
|||
{
|
||||
if (on) {
|
||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||
pcPad->getDocument()->recomputeFeature(pcPad);
|
||||
pcPad->getDocument()->recomputeFeature(pcPad);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,14 +472,14 @@ bool TaskDlgPadParameters::accept()
|
|||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Midplane = %i",name.c_str(),parameter->getMidplane()?1:0);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length2 = %f",name.c_str(),parameter->getLength2());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Type = %u",name.c_str(),parameter->getMode());
|
||||
QByteArray facename = parameter->getFaceName();
|
||||
std::string facename = parameter->getFaceName().data();
|
||||
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
|
||||
Part::Feature* support = pcPad->getSupport();
|
||||
|
||||
if (support != NULL && !facename.isEmpty()) {
|
||||
if (support != NULL && !facename.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
buf = buf.arg(QString::fromUtf8(support->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(facename.data()));
|
||||
buf = buf.arg(QString::fromStdString(facename));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = %s", name.c_str(), buf.toStdString().c_str());
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = None", name.c_str());
|
||||
|
|
|
@ -89,10 +89,10 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
|
|||
bool midplane = pcPocket->Midplane.getValue();
|
||||
int index = pcPocket->Type.getValue(); // must extract value here, clear() kills it!
|
||||
std::vector<std::string> subStrings = pcPocket->UpToFace.getSubValues();
|
||||
std::string upToFace;
|
||||
std::string upToFace;
|
||||
int faceId = -1;
|
||||
if (!subStrings.empty()) {
|
||||
upToFace = subStrings.front();
|
||||
if (!subStrings.empty()) {
|
||||
upToFace = subStrings.front();
|
||||
if (upToFace.substr(0,4) == "Face")
|
||||
faceId = std::atoi(&upToFace[4]);
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ TaskPocketParameters::TaskPocketParameters(ViewProviderPocket *PocketView,QWidge
|
|||
ui->doubleSpinBox->setMaximum(INT_MAX);
|
||||
ui->doubleSpinBox->setValue(l);
|
||||
ui->checkBoxMidplane->setChecked(midplane);
|
||||
ui->lineFaceName->setText(faceId >= 0 ?
|
||||
tr("Face") + QString::number(faceId) :
|
||||
ui->lineFaceName->setText(faceId >= 0 ?
|
||||
tr("Face") + QString::number(faceId) :
|
||||
tr("No face selected"));
|
||||
ui->lineFaceName->setProperty("FaceName", QByteArray(upToFace.c_str()));
|
||||
ui->changeMode->clear();
|
||||
|
@ -192,7 +192,7 @@ void TaskPocketParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
}
|
||||
if (strcmp(msg.pObjectName, support->getNameInDocument()) != 0)
|
||||
return;
|
||||
|
||||
|
||||
std::vector<std::string> upToFaces(1,subName);
|
||||
pcPocket->UpToFace.setValue(support, upToFaces);
|
||||
if (updateView())
|
||||
|
@ -241,13 +241,13 @@ void TaskPocketParameters::onModeChanged(int index)
|
|||
pcPocket->Length.setValue(oldLength);
|
||||
ui->doubleSpinBox->setValue(oldLength);
|
||||
break;
|
||||
case 1:
|
||||
oldLength = pcPocket->Length.getValue();
|
||||
pcPocket->Type.setValue("ThroughAll");
|
||||
case 1:
|
||||
oldLength = pcPocket->Length.getValue();
|
||||
pcPocket->Type.setValue("ThroughAll");
|
||||
break;
|
||||
case 2:
|
||||
oldLength = pcPocket->Length.getValue();
|
||||
pcPocket->Type.setValue("UpToFirst");
|
||||
case 2:
|
||||
oldLength = pcPocket->Length.getValue();
|
||||
pcPocket->Type.setValue("UpToFirst");
|
||||
break;
|
||||
case 3:
|
||||
// Because of the code at the begining of Pocket::execute() which is used to detect
|
||||
|
@ -257,7 +257,7 @@ void TaskPocketParameters::onModeChanged(int index)
|
|||
pcPocket->Length.setValue(0.0);
|
||||
ui->doubleSpinBox->setValue(0.0);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
pcPocket->Type.setValue("Length");
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ void TaskPocketParameters::onButtonFace(const bool pressed) {
|
|||
doc->setShow(support->getNameInDocument());
|
||||
}
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelectionGate
|
||||
Gui::Selection().addSelectionGate
|
||||
(new ReferenceSelection(support, false, true, false));
|
||||
} else {
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
|
@ -430,13 +430,13 @@ bool TaskDlgPocketParameters::accept()
|
|||
//Gui::Command::openCommand("Pocket changed");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length = %f",name.c_str(),parameter->getLength());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Type = %u",name.c_str(),parameter->getMode());
|
||||
QByteArray facename = parameter->getFaceName();
|
||||
std::string facename = parameter->getFaceName().data();
|
||||
PartDesign::Pocket* pcPocket = static_cast<PartDesign::Pocket*>(PocketView->getObject());
|
||||
Part::Feature* support = pcPocket->getSupport();
|
||||
if (support != NULL && !facename.isEmpty()) {
|
||||
if (support != NULL && !facename.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
buf = buf.arg(QString::fromUtf8(support->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(facename.data()));
|
||||
buf = buf.arg(QString::fromStdString(facename));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = %s", name.c_str(), buf.toStdString().c_str());
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.UpToFace = None", name.c_str());
|
||||
|
|
Loading…
Reference in New Issue
Block a user