Skip to content

Commit

Permalink
Dialog for dealing with creation and edeting of node sets
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Mar 3, 2013
1 parent 676583e commit 8d3f1a9
Show file tree
Hide file tree
Showing 28 changed files with 1,376 additions and 53 deletions.
8 changes: 4 additions & 4 deletions src/Mod/Fem/App/FemSetElementsObject.h
Expand Up @@ -40,10 +40,10 @@ class AppFemExport FemSetElementsObject : public FemSetObject
FemSetElementsObject(void);
virtual ~FemSetElementsObject();

/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
//}
// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderSetElements";
}
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Fem/App/FemSetFacesObject.h
Expand Up @@ -40,10 +40,10 @@ class AppFemExport FemSetFacesObject : public FemSetObject
FemSetFacesObject(void);
virtual ~FemSetFacesObject();

/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
//}
// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderSetFaces";
}
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Fem/App/FemSetGeometryObject.h
Expand Up @@ -40,10 +40,10 @@ class AppFemExport FemSetGeometryObject : public FemSetObject
FemSetGeometryObject(void);
virtual ~FemSetGeometryObject();

/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
//}
// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderSetGeometry";
}
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Fem/App/FemSetNodesObject.h
Expand Up @@ -42,10 +42,10 @@ class AppFemExport FemSetNodesObject : public FemSetObject

App::PropertyIntegerSet Nodes;

/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
//}
// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderSetNodes";
}
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Fem/App/FemSetObject.cpp
Expand Up @@ -38,6 +38,7 @@ PROPERTY_SOURCE(Fem::FemSetObject, App::DocumentObject)

FemSetObject::FemSetObject()
{
ADD_PROPERTY_TYPE(FemMesh,(0), "MeshSet link",Prop_None,"MeshSet the set belongs to");
}

FemSetObject::~FemSetObject()
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/Fem/App/FemSetObject.h
Expand Up @@ -25,7 +25,7 @@
#define Fem_FemSetObject_H

#include <App/DocumentObject.h>
#include <App/PropertyStandard.h>
#include <App/PropertyLinks.h>
#include "FemSetObject.h"

namespace Fem
Expand All @@ -40,6 +40,8 @@ class AppFemExport FemSetObject : public App::DocumentObject
FemSetObject(void);
virtual ~FemSetObject();

App::PropertyLink FemMesh;

/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
Expand Down
8 changes: 8 additions & 0 deletions src/Mod/Fem/Gui/AppFemGui.cpp
Expand Up @@ -30,6 +30,10 @@
#include <Gui/Application.h>
#include <Gui/Language/Translator.h>
#include "ViewProviderFemMesh.h"
#include "ViewProviderSetNodes.h"
#include "ViewProviderSetElements.h"
#include "ViewProviderSetFaces.h"
#include "ViewProviderSetGeometry.h"
#include "Workbench.h"
//#include "resources/qrc_Fem.cpp"

Expand Down Expand Up @@ -65,6 +69,10 @@ void FemGuiExport initFemGui()
// addition objects
FemGui::Workbench ::init();
FemGui::ViewProviderFemMesh ::init();
FemGui::ViewProviderSetNodes ::init();
FemGui::ViewProviderSetElements ::init();
FemGui::ViewProviderSetFaces ::init();
FemGui::ViewProviderSetGeometry ::init();

// add resources and reloads the translators
loadFemResource();
Expand Down
63 changes: 51 additions & 12 deletions src/Mod/Fem/Gui/CMakeLists.txt
Expand Up @@ -31,30 +31,58 @@ endif(SMESH_FOUND)

set(FemGui_MOC_HDRS
Hypothesis.h
TaskObjectName.h
TaskCreateNodeSet.h
TaskDlgCreateNodeSet.h
)
fc_wrap_cpp(FemGui_MOC_SRCS ${FemGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS})

set(FemGui_UIC_SRCS
Hypothesis.ui
TaskCreateNodeSet.ui
TaskObjectName.ui
)
qt4_wrap_ui(FemGui_UIC_HDRS ${FemGui_UIC_SRCS})
SET(FemGui_DLG_SRCS
${FemGui_UIC_HDRS}
Hypothesis.ui
Hypothesis.cpp
Hypothesis.h
)
SOURCE_GROUP("Dialogs" FILES ${FemGui_DLG_SRCS})

qt4_add_resources(FemResource_SRCS Resources/Fem.qrc)

SOURCE_GROUP("Resources" FILES ${FemResource_SRCS})

SET(FemGui_SRCS_ViewProvider
ViewProviderFemMesh.cpp
ViewProviderFemMesh.h
ViewProviderSetNodes.cpp
ViewProviderSetNodes.h
ViewProviderSetElements.cpp
ViewProviderSetElements.h
ViewProviderSetFaces.cpp
ViewProviderSetFaces.h
ViewProviderSetGeometry.cpp
ViewProviderSetGeometry.h
)
SOURCE_GROUP("ViewProvider" FILES ${FemGui_SRCS_ViewProvider})

SET(FemGui_SRCS_TaskBoxes
TaskObjectName.ui
TaskObjectName.cpp
TaskObjectName.h
TaskCreateNodeSet.ui
TaskCreateNodeSet.cpp
TaskCreateNodeSet.h
)
SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes})

SET(FemGui_SRCS
${FemGui_DLG_SRCS}
${FemResource_SRCS}
SET(FemGui_SRCS_TaskDlg
TaskDlgCreateNodeSet.h
TaskDlgCreateNodeSet.cpp
Hypothesis.ui
Hypothesis.cpp
Hypothesis.h
)
SOURCE_GROUP("Task_Dialogs" FILES ${FemGui_SRCS_TaskDlg})

SET(FemGui_SRCS_Module
AppFemGui.cpp
AppFemGuiPy.cpp
Command.cpp
Expand All @@ -63,10 +91,21 @@ SET(FemGui_SRCS
PreCompiled.h
Workbench.cpp
Workbench.h
ViewProviderFemMesh.cpp
ViewProviderFemMesh.h
)
SOURCE_GROUP("Module" FILES ${FemGui_SRCS_Module})

SET(FemGui_SRCS
${FemGui_UIC_HDRS}
${FemGui_DLG_SRCS}
${FemResource_SRCS}
${FemGui_SRCS_ViewProvider}
${FemGui_SRCS_TaskDlg}
${FemGui_SRCS_TaskBoxes}
${FemGui_SRCS_Module}
)



add_library(FemGui SHARED ${FemGui_SRCS})
target_link_libraries(FemGui ${FemGui_LIBS})

Expand Down
52 changes: 51 additions & 1 deletion src/Mod/Fem/Gui/Command.cpp
Expand Up @@ -50,6 +50,7 @@
#include <SMDSAbs_ElementType.hxx>

#include <Mod/Fem/App/FemMeshObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
#include <strstream>

#include "Hypothesis.h"
Expand Down Expand Up @@ -85,6 +86,7 @@ bool CmdFemCreateFromShape::isActive(void)
}


// #####################################################################################################



Expand Down Expand Up @@ -180,7 +182,7 @@ CmdFemDefineNodesSet::CmdFemDefineNodesSet()
sToolTipText = QT_TR_NOOP("Create node set by Poly");
sWhatsThis = "Create node set by Poly";
sStatusTip = QT_TR_NOOP("Create node set by Poly");
sPixmap = "mesh_cut";
sPixmap = "Fem_FemMesh";
}

void CmdFemDefineNodesSet::activated(int iMsg)
Expand Down Expand Up @@ -223,12 +225,60 @@ bool CmdFemDefineNodesSet::isActive(void)
return false;
}


// #####################################################################################################

DEF_STD_CMD_A(CmdFemCreateNodesSet);

CmdFemCreateNodesSet::CmdFemCreateNodesSet()
:Command("Fem_CreateNodesSet")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Define/create a nodes set...");
sToolTipText = QT_TR_NOOP("Define/create a nodes set...");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "Fem_FemMesh";

}


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());

}
}

bool CmdFemCreateNodesSet::isActive(void)
{
return true;
}

//--------------------------------------------------------------------------------------


void CreateFemCommands(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdFemCreateFromShape());
rcCmdMgr.addCommand(new CmdFemCreateNodesSet());
rcCmdMgr.addCommand(new CmdFemDefineNodesSet());
}

0 comments on commit 8d3f1a9

Please sign in to comment.