本文整理汇总了C++中fem::FemAnalysis::getNameInDocument方法的典型用法代码示例。如果您正苦于以下问题:C++ FemAnalysis::getNameInDocument方法的具体用法?C++ FemAnalysis::getNameInDocument怎么用?C++ FemAnalysis::getNameInDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fem::FemAnalysis
的用法示例。
在下文中一共展示了FemAnalysis::getNameInDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activated
void CmdFemConstraintPressure::activated(int iMsg)
{
Fem::FemAnalysis *Analysis;
if(getConstraintPrerequisits(&Analysis))
return;
std::string FeatName = getUniqueObjectName("FemConstraintPressure");
openCommand("Make FEM constraint pressure on face");
doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPressure\",\"%s\")",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Pressure = 0.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",
Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str());
updateActive();
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
}
示例2: DefineNodesCallback
void DefineNodesCallback(void * ud, SoEventCallback * n)
{
Fem::FemAnalysis *Analysis;
if(getConstraintPrerequisits(&Analysis))
return;
// show the wait cursor because this could take quite some time
Gui::WaitCursor wc;
// When this callback function is invoked we must in either case leave the edit mode
Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData());
view->setEditing(false);
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,ud);
n->setHandled();
SbBool clip_inner;
std::vector<SbVec2f> clPoly = view->getGLPolygon(&clip_inner);
if (clPoly.size() < 3)
return;
if (clPoly.front() != clPoly.back())
clPoly.push_back(clPoly.front());
SoCamera* cam = view->getCamera();
SbViewVolume vv = cam->getViewVolume();
Gui::ViewVolumeProjection proj(vv);
Base::Polygon2D polygon;
for (std::vector<SbVec2f>::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it)
polygon.Add(Base::Vector2D((*it)[0],(*it)[1]));
std::vector<App::DocumentObject*> docObj = Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId());
if(docObj.size() !=1)
return;
const SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(dynamic_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh())->GetMeshDS();
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
Base::Vector3f pt2d;
std::set<int> IntSet;
for (int i=0;aNodeIter->more();) {
const SMDS_MeshNode* aNode = aNodeIter->next();
Base::Vector3f vec(aNode->X(),aNode->Y(),aNode->Z());
pt2d = proj(vec);
if (polygon.Contains(Base::Vector2D(pt2d.x, pt2d.y)) == true)
IntSet.insert(aNode->GetID());
}
std::stringstream set;
set << "[";
for(std::set<int>::const_iterator it=IntSet.begin();it!=IntSet.end();++it)
if(it==IntSet.begin())
set << *it ;
else
set << "," << *it ;
set << "]";
Gui::Command::openCommand("Place robot");
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.addObject('Fem::FemSetNodesObject','NodeSet')");
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.ActiveObject.Nodes = %s",set.str().c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().NodeSet]",Analysis->getNameInDocument(),Analysis->getNameInDocument());
////Gui::Command::updateActive();
Gui::Command::commitCommand();
//std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
//if (!views.empty()) {
// Gui::Application::Instance->activeDocument()->openCommand("Cut");
// for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
// ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
// if (that->getEditingMode() > -1) {
// that->finishEditing();
// that->cutMesh(clPoly, *view, clip_inner);
// }
// }
// Gui::Application::Instance->activeDocument()->commitCommand();
// view->render();
//}
}
示例3: activated
void CmdFemConstraintPulley::activated(int iMsg)
{
Fem::FemAnalysis *Analysis;
if(getConstraintPrerequisits(&Analysis))
return;
std::string FeatName = getUniqueObjectName("FemConstraintPulley");
openCommand("Make FEM constraint for pulley");
doCommand(Doc,"App.activeDocument().addObject(\"Fem::ConstraintPulley\",\"%s\")",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Diameter = 300.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.OtherDiameter = 100.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.CenterDistance = 500.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Force = 100.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.TensionForce = 100.0",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s.Member + [App.activeDocument().%s]",Analysis->getNameInDocument(),Analysis->getNameInDocument(),FeatName.c_str());
updateActive();
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
}