void CmdFemCreateNodesSet::activated(int iMsg) { Gui::SelectionFilter ObjectFilter("SELECT Fem::FemSetNodesObject COUNT 1"); Gui::SelectionFilter FemMeshFilter ("SELECT Fem::FemMeshObject COUNT 1"); if (ObjectFilter.match()) { Fem::FemSetNodesObject *NodesObj = static_cast<Fem::FemSetNodesObject*>(ObjectFilter.Result[0][0].getObject()); openCommand("Edit nodes-set"); doCommand(Gui,"Gui.activeDocument().setEdit('%s')",NodesObj->getNameInDocument()); }else if (FemMeshFilter.match()) { Fem::FemMeshObject *MeshObj = static_cast<Fem::FemMeshObject*>(FemMeshFilter.Result[0][0].getObject()); std::string FeatName = getUniqueObjectName("NodesSet"); openCommand("Create a new nodes-set"); doCommand(Doc,"App.activeDocument().addObject('Fem::FemSetNodesObject','%s')",FeatName.c_str()); doCommand(Gui,"App.activeDocument().%s.FemMesh = App.activeDocument().%s",FeatName.c_str(),MeshObj->getNameInDocument()); doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); } }
void CmdFemCreateNodesSet::activated(int iMsg) { Gui::SelectionFilter ObjectFilter("SELECT Fem::FemSetNodesObject COUNT 1"); Gui::SelectionFilter FemMeshFilter("SELECT Fem::FemMeshObject COUNT 1"); if (ObjectFilter.match()) { Fem::FemSetNodesObject *NodesObj = static_cast<Fem::FemSetNodesObject*>(ObjectFilter.Result[0][0].getObject()); openCommand("Edit nodes set"); doCommand(Gui,"Gui.activeDocument().setEdit('%s')",NodesObj->getNameInDocument()); } else if (FemMeshFilter.match()) { Fem::FemMeshObject *MeshObj = static_cast<Fem::FemMeshObject*>(FemMeshFilter.Result[0][0].getObject()); std::string FeatName = getUniqueObjectName("NodesSet"); openCommand("Create nodes set"); doCommand(Doc,"App.activeDocument().addObject('Fem::FemSetNodesObject','%s')",FeatName.c_str()); doCommand(Gui,"App.activeDocument().%s.FemMesh = App.activeDocument().%s",FeatName.c_str(),MeshObj->getNameInDocument()); doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str()); } else { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("CmdFemCreateNodesSet", "Wrong selection"), qApp->translate("CmdFemCreateNodesSet", "Select a single FEM mesh or nodes set, please.")); } }