当前位置: 首页>>代码示例>>C++>>正文


C++ Pad::getDocument方法代码示例

本文整理汇总了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);
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:28,代码来源:TaskPadParameters.cpp

示例2: onUpdateView

void TaskPadParameters::onUpdateView(bool on)
{
    if (on) {
        PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
        pcPad->getDocument()->recomputeFeature(pcPad);
    }
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:7,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:7,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:7,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:8,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Koelie2,项目名称:freecad,代码行数:9,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Koelie2,项目名称:freecad,代码行数:16,代码来源:TaskPadParameters.cpp

示例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()));
    }
}
开发者ID:Koelie2,项目名称:freecad,代码行数:18,代码来源:TaskPadParameters.cpp

示例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);
    }
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:44,代码来源:TaskPadParameters.cpp

示例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);
}
开发者ID:Barleyman,项目名称:FreeCAD_sf_master,代码行数:22,代码来源:TaskPadParameters.cpp

示例11: onMidplane

void TaskPadParameters::onMidplane(bool on)
{
    PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(PadView->getObject());
    pcPad->Midplane.setValue(on);
    pcPad->getDocument()->recomputeFeature(pcPad);
}
开发者ID:Koelie2,项目名称:freecad,代码行数:6,代码来源:TaskPadParameters.cpp


注:本文中的partdesign::Pad::getDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。