本文整理汇总了C++中partdesign::Groove::getSketchAxisCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Groove::getSketchAxisCount方法的具体用法?C++ Groove::getSketchAxisCount怎么用?C++ Groove::getSketchAxisCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类partdesign::Groove
的用法示例。
在下文中一共展示了Groove::getSketchAxisCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEdit
bool ViewProviderGroove::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
PartDesign::Groove* pcGroove = static_cast<PartDesign::Groove*>(getObject());
if (pcGroove->getSketchAxisCount() < 0) {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setWindowTitle(QObject::tr("Lost link to base sketch"));
msgBox.setText(QObject::tr("The object can't be edited because the link to the the base sketch is lost."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return false;
}
// When double-clicking on the item for this pad the
// object unsets and sets its edit mode without closing
// the task panel
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgGrooveParameters *padDlg = qobject_cast<TaskDlgGrooveParameters *>(dlg);
if (padDlg && padDlg->getGrooveView() != this)
padDlg = 0; // another pad left open its task panel
if (dlg && !padDlg) {
QMessageBox msgBox;
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
if (ret == QMessageBox::Yes)
Gui::Control().reject();
else
return false;
}
// clear the selection (convenience)
Gui::Selection().clearSelection();
//if (ModNum == 1)
// Gui::Command::openCommand("Change Groove parameters");
// start the edit dialog
if (padDlg)
Gui::Control().showDialog(padDlg);
else
Gui::Control().showDialog(new TaskDlgGrooveParameters(this));
return true;
}
else {
return PartGui::ViewProviderPart::setEdit(ModNum);
}
}
示例2: if
TaskGrooveParameters::TaskGrooveParameters(ViewProviderGroove *GrooveView,QWidget *parent)
: TaskBox(Gui::BitmapFactory().pixmap("PartDesign_Groove"),tr("Groove parameters"),true, parent),GrooveView(GrooveView)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
ui = new Ui_TaskGrooveParameters();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->grooveAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->axis, SIGNAL(activated(int)),
this, SLOT(onAxisChanged(int)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplane(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversed(bool)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
this->groupLayout()->addWidget(proxy);
// Temporarily prevent unnecessary feature updates
ui->grooveAngle->blockSignals(true);
ui->axis->blockSignals(true);
ui->checkBoxMidplane->blockSignals(true);
ui->checkBoxReversed->blockSignals(true);
PartDesign::Groove* pcGroove = static_cast<PartDesign::Groove*>(GrooveView->getObject());
double l = pcGroove->Angle.getValue();
bool mirrored = pcGroove->Midplane.getValue();
bool reversed = pcGroove->Reversed.getValue();
ui->grooveAngle->setValue(l);
ui->grooveAngle->bind(pcGroove->Angle);
int count=pcGroove->getSketchAxisCount();
for (int i=ui->axis->count()-1; i >= count+2; i--)
ui->axis->removeItem(i);
for (int i=ui->axis->count(); i < count+2; i++)
ui->axis->addItem(QString::fromLatin1("Sketch axis %1").arg(i-2));
int pos=-1;
App::DocumentObject *pcReferenceAxis = pcGroove->ReferenceAxis.getValue();
const std::vector<std::string> &subReferenceAxis = pcGroove->ReferenceAxis.getSubValues();
if (pcReferenceAxis && pcReferenceAxis == pcGroove->Sketch.getValue()) {
assert(subReferenceAxis.size()==1);
if (subReferenceAxis[0] == "V_Axis")
pos = 0;
else if (subReferenceAxis[0] == "H_Axis")
pos = 1;
else if (subReferenceAxis[0].size() > 4 && subReferenceAxis[0].substr(0,4) == "Axis")
pos = 2 + std::atoi(subReferenceAxis[0].substr(4,4000).c_str());
}
if (pos < 0 || pos >= ui->axis->count()) {
ui->axis->addItem(QString::fromLatin1("Undefined"));
pos = ui->axis->count()-1;
}
ui->axis->setCurrentIndex(pos);
ui->checkBoxMidplane->setChecked(mirrored);
ui->checkBoxReversed->setChecked(reversed);
ui->grooveAngle->blockSignals(false);
ui->axis->blockSignals(false);
ui->checkBoxMidplane->blockSignals(false);
ui->checkBoxReversed->blockSignals(false);
setFocus ();
}