本文整理汇总了C++中partdesign::Pad::getDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ Pad::getDocument方法的具体用法?C++ Pad::getDocument怎么用?C++ Pad::getDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类partdesign::Pad
的用法示例。
在下文中一共展示了Pad::getDocument方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onFaceName
void TaskPadParameters::onFaceName(const QString& text)
{
// We must expect that "text" is the translation of "Face" followed by an ID.
QString name;
QTextStream str(&name);
str << "^" << tr("Face") << "(\\d+)$";
QRegExp rx(name);
if (text.indexOf(rx) < 0) {
ui->lineFaceName->setProperty("FaceName", QByteArray());
return;
}
int faceId = rx.cap(1).toInt();
std::stringstream ss;
ss << "Face" << faceId;
ui->lineFaceName->setProperty("FaceName", QByteArray(ss.str().c_str()));
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
Part::Feature* support = pcPad->getSupport();
if (support == NULL) {
// There is no support, so we can't select from it...
return;
}
std::vector<std::string> upToFaces(1,ss.str());
pcPad->UpToFace.setValue(support, upToFaces);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例2: onUpdateView
void TaskPadParameters::onUpdateView(bool on)
{
if (on) {
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->getDocument()->recomputeFeature(pcPad);
}
}
示例3:
void TaskPadParameters::onLength2Changed(double len)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->Length2.setValue(len);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例4: onReversed
void TaskPadParameters::onReversed(bool on)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->Reversed.setValue(on);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例5: onMidplane
void TaskPadParameters::onMidplane(bool on)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->Midplane.setValue(on);
ui->checkBoxReversed->setEnabled(!on);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例6: onFaceName
void TaskPadParameters::onFaceName(const QString& text)
{
if (text.left(4) != tr("Face"))
return;
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->FaceName.setValue(text.toUtf8());
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例7: onModeChanged
void TaskPadParameters::onModeChanged(int index)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
switch (index) {
case 0: pcPad->Type.setValue("Length"); break;
case 1: pcPad->Type.setValue("UpToLast"); break;
case 2: pcPad->Type.setValue("UpToFirst"); break;
case 3: pcPad->Type.setValue("UpToFace"); break;
default: pcPad->Type.setValue("TwoLengths");
}
updateUI(index);
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例8: onSelectionChanged
void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
if (pcPad->Type.getValue() != 3) // ignore user selections if mode is not upToFace
return;
if (!msg.pSubName || msg.pSubName[0] == '\0')
return;
std::string element(msg.pSubName);
if (element.substr(0,4) != "Face")
return;
if (msg.Type == Gui::SelectionChanges::AddSelection) {
pcPad->FaceName.setValue(element);
pcPad->getDocument()->recomputeFeature(pcPad);
ui->lineFaceName->setText(tr(element.c_str()));
}
}
示例9: onSelectionChanged
void TaskPadParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
{
if (msg.Type == Gui::SelectionChanges::AddSelection) {
// Don't allow selection in other document
if (strcmp(msg.pDocName, PadView->getObject()->getDocument()->getName()) != 0)
return;
if (!msg.pSubName || msg.pSubName[0] == '\0')
return;
std::string subName(msg.pSubName);
if (subName.substr(0,4) != "Face")
return;
int faceId = std::atoi(&subName[4]);
// Don't allow selection outside support
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
Part::Feature* support = pcPad->getSupport();
if (support == NULL) {
// There is no support, so we can't select from it...
// Turn off reference selection mode
onButtonFace(false);
return;
}
if (strcmp(msg.pObjectName, support->getNameInDocument()) != 0)
return;
std::vector<std::string> upToFaces(1,subName);
pcPad->UpToFace.setValue(support, upToFaces);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
ui->lineFaceName->blockSignals(true);
ui->lineFaceName->setText(tr("Face") + QString::number(faceId));
ui->lineFaceName->setProperty("FaceName", QByteArray(subName.c_str()));
ui->lineFaceName->blockSignals(false);
// Turn off reference selection mode
onButtonFace(false);
}
else if (msg.Type == Gui::SelectionChanges::ClrSelection) {
ui->lineFaceName->blockSignals(true);
ui->lineFaceName->setText(tr("No face selected"));
ui->lineFaceName->setProperty("FaceName", QByteArray());
ui->lineFaceName->blockSignals(false);
}
}
示例10: onModeChanged
void TaskPadParameters::onModeChanged(int index)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
switch (index) {
case 0:
pcPad->Type.setValue("Length");
// Avoid error message
if (ui->lengthEdit->getQuantity() < Precision::Confusion())
ui->lengthEdit->setValue(5.0);
break;
case 1: pcPad->Type.setValue("UpToLast"); break;
case 2: pcPad->Type.setValue("UpToFirst"); break;
case 3: pcPad->Type.setValue("UpToFace"); break;
default: pcPad->Type.setValue("TwoLengths");
}
updateUI(index);
if (updateView())
pcPad->getDocument()->recomputeFeature(pcPad);
}
示例11: onMidplane
void TaskPadParameters::onMidplane(bool on)
{
PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
pcPad->Midplane.setValue(on);
pcPad->getDocument()->recomputeFeature(pcPad);
}