本文整理汇总了C++中app::DocumentObject::getStatusString方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentObject::getStatusString方法的具体用法?C++ DocumentObject::getStatusString怎么用?C++ DocumentObject::getStatusString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::DocumentObject
的用法示例。
在下文中一共展示了DocumentObject::getStatusString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accept
bool SweepWidget::accept()
{
if (d->loop.isRunning())
return false;
Gui::SelectionFilter edgeFilter ("SELECT Part::Feature SUBELEMENT Edge COUNT 1..");
Gui::SelectionFilter partFilter ("SELECT Part::Feature COUNT 1");
bool matchEdge = edgeFilter.match();
bool matchPart = partFilter.match();
if (!matchEdge && !matchPart) {
QMessageBox::critical(this, tr("Sweep path"), tr("Select one or more connected edges you want to sweep along."));
return false;
}
// get the selected object
std::string selection;
std::string spineObject, spineLabel;
const std::vector<Gui::SelectionObject>& result = matchEdge
? edgeFilter.Result[0] : partFilter.Result[0];
selection = result.front().getAsPropertyLinkSubString();
spineObject = result.front().getFeatName();
spineLabel = result.front().getObject()->Label.getValue();
QString list, solid, frenet;
if (d->ui.checkSolid->isChecked())
solid = QString::fromLatin1("True");
else
solid = QString::fromLatin1("False");
if (d->ui.checkFrenet->isChecked())
frenet = QString::fromLatin1("True");
else
frenet = QString::fromLatin1("False");
QTextStream str(&list);
int count = d->ui.selector->selectedTreeWidget()->topLevelItemCount();
if (count < 1) {
QMessageBox::critical(this, tr("Too few elements"), tr("At least one edge or wire is required."));
return false;
}
for (int i=0; i<count; i++) {
QTreeWidgetItem* child = d->ui.selector->selectedTreeWidget()->topLevelItem(i);
QString name = child->data(0, Qt::UserRole).toString();
if (name == QLatin1String(spineObject.c_str())) {
QMessageBox::critical(this, tr("Wrong selection"), tr("'%1' cannot be used as profile and path.")
.arg(QString::fromUtf8(spineLabel.c_str())));
return false;
}
str << "App.getDocument('" << d->document.c_str() << "')." << name << ", ";
}
try {
Gui::WaitCursor wc;
QString cmd;
cmd = QString::fromLatin1(
"App.getDocument('%5').addObject('Part::Sweep','Sweep')\n"
"App.getDocument('%5').ActiveObject.Sections=[%1]\n"
"App.getDocument('%5').ActiveObject.Spine=%2\n"
"App.getDocument('%5').ActiveObject.Solid=%3\n"
"App.getDocument('%5').ActiveObject.Frenet=%4\n"
)
.arg(list)
.arg(QLatin1String(selection.c_str()))
.arg(solid)
.arg(frenet)
.arg(QString::fromLatin1(d->document.c_str()));
Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str());
if (!doc) throw Base::Exception("Document doesn't exist anymore");
doc->openCommand("Sweep");
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
doc->getDocument()->recompute();
App::DocumentObject* obj = doc->getDocument()->getActiveObject();
if (obj && !obj->isValid()) {
std::string msg = obj->getStatusString();
doc->abortCommand();
throw Base::Exception(msg);
}
doc->commitCommand();
}
catch (const Base::Exception& e) {
QMessageBox::warning(this, tr("Input error"), QString::fromLatin1(e.what()));
return false;
}
return true;
}