本文整理汇总了C++中part::Feature::getGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Feature::getGroup方法的具体用法?C++ Feature::getGroup怎么用?C++ Feature::getGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类part::Feature
的用法示例。
在下文中一共展示了Feature::getGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activated
void CmdSketcherNewSketch::activated(int iMsg)
{
Attacher::eMapMode mapmode = Attacher::mmDeactivated;
bool bAttach = false;
if (Gui::Selection().hasSelection()){
Attacher::SuggestResult::eSuggestResult msgid = Attacher::SuggestResult::srOK;
QString msg_str;
std::vector<Attacher::eMapMode> validModes;
mapmode = SuggestAutoMapMode(&msgid, &msg_str, &validModes);
if (msgid == Attacher::SuggestResult::srOK)
bAttach = true;
if (msgid != Attacher::SuggestResult::srOK && msgid != Attacher::SuggestResult::srNoModesFit){
QMessageBox::warning(Gui::getMainWindow(),
QObject::tr("Sketch mapping"),
QObject::tr("Can't map the skecth to selected object. %1.").arg(msg_str));
return;
}
if (validModes.size() > 1){
validModes.insert(validModes.begin(), Attacher::mmDeactivated);
bool ok;
QStringList items;
items.push_back(QObject::tr("Don't attach"));
int iSugg = 0;//index of the auto-suggested mode in the list of valid modes
for (size_t i = 0 ; i < validModes.size() ; ++i){
items.push_back(QString::fromLatin1(AttachEngine::getModeName(validModes[i]).c_str()));
if (validModes[i] == mapmode)
iSugg = items.size()-1;
}
QString text = QInputDialog::getItem(Gui::getMainWindow(),
qApp->translate(className(), "Sketch attachment"),
qApp->translate(className(), "Select the method to attach this sketch to selected object"),
items, iSugg, false, &ok);
if (!ok) return;
int index = items.indexOf(text);
if (index == 0){
bAttach = false;
mapmode = Attacher::mmDeactivated;
} else {
bAttach = true;
mapmode = validModes[index-1];
}
}
}
if (bAttach) {
std::vector<Gui::SelectionObject> objects = Gui::Selection().getSelectionEx();
//assert (objects.size() == 1); //should have been filtered out by SuggestAutoMapMode
//Gui::SelectionObject &sel_support = objects[0];
App::PropertyLinkSubList support;
Gui::Selection().getAsPropertyLinkSubList(support);
std::string supportString = support.getPyReprString();
// create Sketch on Face
std::string FeatName = getUniqueObjectName("Sketch");
openCommand("Create a Sketch on Face");
doCommand(Doc,"App.activeDocument().addObject('Sketcher::SketchObject','%s')",FeatName.c_str());
if (mapmode >= 0 && mapmode < Attacher::mmDummy_NumberOfModes)
doCommand(Gui,"App.activeDocument().%s.MapMode = \"%s\"",FeatName.c_str(),AttachEngine::getModeName(mapmode).c_str());
else
assert(0 /* mapmode index out of range */);
doCommand(Gui,"App.activeDocument().%s.Support = %s",FeatName.c_str(),supportString.c_str());
doCommand(Gui,"App.activeDocument().recompute()"); // recompute the sketch placement based on its support
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
Part::Feature *part = static_cast<Part::Feature*>(support.getValue());//if multi-part support, this will return 0
if (part){
App::DocumentObjectGroup* grp = part->getGroup();
if (grp) {
doCommand(Doc,"App.activeDocument().%s.addObject(App.activeDocument().%s)"
,grp->getNameInDocument(),FeatName.c_str());
}
}
}
else {
// ask user for orientation
SketchOrientationDialog Dlg;
if (Dlg.exec() != QDialog::Accepted)
return; // canceled
Base::Vector3d p = Dlg.Pos.getPosition();
Base::Rotation r = Dlg.Pos.getRotation();
// do the right view direction
std::string camstring;
switch(Dlg.DirType){
case 0:
camstring = "#Inventor V2.1 ascii \\n OrthographicCamera {\\n viewportMapping ADJUST_CAMERA \\n position 0 0 87 \\n orientation 0 0 1 0 \\n nearDistance -112.88701 \\n farDistance 287.28702 \\n aspectRatio 1 \\n focalDistance 87 \\n height 143.52005 }";
break;
case 1:
camstring = "#Inventor V2.1 ascii \\n OrthographicCamera {\\n viewportMapping ADJUST_CAMERA \\n position 0 0 -87 \\n orientation -1 0 0 3.1415927 \\n nearDistance -112.88701 \\n farDistance 287.28702 \\n aspectRatio 1 \\n focalDistance 87 \\n height 143.52005 }";
break;
case 2:
camstring = "#Inventor V2.1 ascii \\n OrthographicCamera {\\n viewportMapping ADJUST_CAMERA\\n position 0 -87 0 \\n orientation -1 0 0 4.712389\\n nearDistance -112.88701\\n farDistance 287.28702\\n aspectRatio 1\\n focalDistance 87\\n height 143.52005\\n\\n}";
break;
case 3:
camstring = "#Inventor V2.1 ascii \\n OrthographicCamera {\\n viewportMapping ADJUST_CAMERA\\n position 0 87 0 \\n orientation 0 0.70710683 0.70710683 3.1415927\\n nearDistance -112.88701\\n farDistance 287.28702\\n aspectRatio 1\\n focalDistance 87\\n height 143.52005\\n\\n}";
break;
case 4:
//.........这里部分代码省略.........