Dialog for dealing with creation and edeting of node sets

This commit is contained in:
jriegel 2013-03-03 22:19:04 +01:00
parent 676583eac0
commit 8d3f1a9f24
28 changed files with 1376 additions and 53 deletions

View File

@ -40,10 +40,10 @@ public:
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;
}

View File

@ -40,10 +40,10 @@ public:
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;
}

View File

@ -40,10 +40,10 @@ public:
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;
}

View File

@ -42,10 +42,10 @@ public:
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;
}

View File

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

View File

@ -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
@ -40,6 +40,8 @@ public:
FemSetObject(void);
virtual ~FemSetObject();
App::PropertyLink FemMesh;
/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";

View File

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

View File

@ -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
${FemGui_DLG_SRCS}
${FemResource_SRCS}
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_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
@ -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})

View File

@ -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"
@ -85,6 +86,7 @@ bool CmdFemCreateFromShape::isActive(void)
}
// #####################################################################################################
@ -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)
@ -223,6 +225,53 @@ 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;
}
//--------------------------------------------------------------------------------------
@ -230,5 +279,6 @@ void CreateFemCommands(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdFemCreateFromShape());
rcCmdMgr.addCommand(new CmdFemCreateNodesSet());
rcCmdMgr.addCommand(new CmdFemDefineNodesSet());
}

View File

@ -0,0 +1,170 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#include <QString>
#include <QSlider>
#include "ui_TaskCreateNodeSet.h"
#include "TaskCreateNodeSet.h"
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/BitmapFactory.h>
#include <Gui/ViewProvider.h>
#include <Gui/WaitCursor.h>
#include <Base/Console.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/Utilities.h>
#include <Inventor/nodes/SoEventCallback.h>
#include <Inventor/nodes/SoCamera.h>
#include <Inventor/events/SoMouseButtonEvent.h>
#include <SMESH_Mesh.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMDSAbs_ElementType.hxx>
#include <Mod/Fem/App/FemMeshObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
#include "ViewProviderFemMesh.h"
using namespace FemGui;
using namespace Gui;
TaskCreateNodeSet::TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *parent)
: TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh"),
tr("Nodes set"),
true,
parent),
pcObject(pcObject)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
ui = new Ui_TaskCreateNodeSet();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
this->groupLayout()->addWidget(proxy);
QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly()));
QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int)));
MeshViewProvider = dynamic_cast<ViewProviderFemMesh*>(Gui::Application::Instance->getViewProvider( pcObject->FemMesh.getValue<Fem::FemMeshObject*>()));
assert(MeshViewProvider);
tempSet = pcObject->Nodes.getValues();
MeshViewProvider->setHighlightNodes(tempSet);
ui->groupBox_AngleSearch->setEnabled(false);
}
void TaskCreateNodeSet::Poly(void)
{
Gui::Document* doc = Gui::Application::Instance->activeDocument();
Gui::MDIView* view = doc->getActiveView();
if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer();
viewer->setEditing(true);
viewer->startSelection(Gui::View3DInventorViewer::Clip);
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback,this);
}
}
void TaskCreateNodeSet::SwitchMethod(int Value)
{
if(Value == 1)
ui->groupBox_AngleSearch->setEnabled(true);
else
ui->groupBox_AngleSearch->setEnabled(false);
}
void TaskCreateNodeSet::DefineNodesCallback(void * ud, SoEventCallback * n)
{
// show the wait cursor because this could take quite some time
Gui::WaitCursor wc;
TaskCreateNodeSet *taskBox = static_cast<TaskCreateNodeSet *>(ud);
// 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]));
taskBox->DefineNodes(polygon,proj);
}
void TaskCreateNodeSet::DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj)
{
const SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(pcObject->FemMesh.getValue<Fem::FemMeshObject*>()->FemMesh.getValue().getSMesh())->GetMeshDS();
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
Base::Vector3f pt2d;
if(! ui->checkBox_Add->isChecked())
tempSet.clear();
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)
tempSet.insert(aNode->GetID());
}
MeshViewProvider->setHighlightNodes(tempSet);
}
TaskCreateNodeSet::~TaskCreateNodeSet()
{
delete ui;
}
#include "moc_TaskCreateNodeSet.cpp"

View File

@ -0,0 +1,81 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_TASKVIEW_TaskCreateNodeSet_H
#define GUI_TASKVIEW_TaskCreateNodeSet_H
#include <Gui/TaskView/TaskView.h>
#include <Gui/Selection.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
class Ui_TaskCreateNodeSet;
class SoEventCallback;
namespace Base {
class Polygon2D;
}
namespace App {
class Property;
}
namespace Gui {
class ViewProvider;
class ViewVolumeProjection;
}
namespace FemGui {
class ViewProviderFemMesh;
class TaskCreateNodeSet : public Gui::TaskView::TaskBox
{
Q_OBJECT
public:
TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *parent = 0);
~TaskCreateNodeSet();
std::set<long> tempSet;
ViewProviderFemMesh * MeshViewProvider;
private Q_SLOTS:
void Poly(void);
void SwitchMethod(int Value);
protected:
Fem::FemSetNodesObject *pcObject;
static void DefineNodesCallback(void * ud, SoEventCallback * n);
void DefineNodes(const Base::Polygon2D &polygon,const Gui::ViewVolumeProjection &proj);
private:
QWidget* proxy;
Ui_TaskCreateNodeSet* ui;
};
} //namespace PartDesignGui
#endif // GUI_TASKVIEW_TaskCreateNodeSet_H

View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskCreateNodeSet</class>
<widget class="QWidget" name="TaskCreateNodeSet">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>177</width>
<height>180</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Volume</string>
</property>
</item>
<item>
<property name="text">
<string>Surface</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_NodesNbr">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Nodes: 0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="toolButton_Poly">
<property name="text">
<string>Poly</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_Box">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Box</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_Pick">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Pick</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_Add">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_AngleSearch">
<property name="title">
<string>Angle-search</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox_AngleSearch">
<property name="text">
<string>Collect adjancent nodes</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Stop angle:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxSizing">
<property name="suffix">
<string comment="mm" extracomment="max deviation in mm"/>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1800.000000000000000</double>
</property>
<property name="singleStep">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>60.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,104 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "TaskDlgCreateNodeSet.h"
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Gui/TaskView/TaskSelectLinkProperty.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
#include "ViewProviderFemMesh.h"
using namespace FemGui;
//**************************************************************************
//**************************************************************************
// TaskDialog
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TaskDlgCreateNodeSet::TaskDlgCreateNodeSet(Fem::FemSetNodesObject *obj)
: TaskDialog(),FemSetNodesObject(obj)
{
name = new TaskObjectName(obj);
param = new TaskCreateNodeSet(obj);
Content.push_back(name);
Content.push_back(param);
}
TaskDlgCreateNodeSet::~TaskDlgCreateNodeSet()
{
}
//==== calls from the TaskView ===============================================================
void TaskDlgCreateNodeSet::open()
{
//select->activate();
//Edge2TaskObject->execute();
//param->setEdgeAndClusterNbr(Edge2TaskObject->NbrOfEdges,Edge2TaskObject->NbrOfCluster);
}
bool TaskDlgCreateNodeSet::accept()
{
try {
FemSetNodesObject->Nodes.setValues(param->tempSet);
FemSetNodesObject->recompute();
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if(doc)
doc->resetEdit();
param->MeshViewProvider->resetHighlightNodes();
return true;
}
catch (const Base::Exception& e) {
Base::Console().Warning("TaskDlgCreateNodeSet::accept(): %s\n", e.what());
}
return false;
}
bool TaskDlgCreateNodeSet::reject()
{
FemSetNodesObject->execute();
param->MeshViewProvider->resetHighlightNodes();
return true;
}
void TaskDlgCreateNodeSet::helpRequested()
{
}
#include "moc_TaskDlgCreateNodeSet.cpp"

View File

@ -0,0 +1,74 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef ROBOTGUI_TaskDlgCreateNodeSet_H
#define ROBOTGUI_TaskDlgCreateNodeSet_H
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
#include "TaskCreateNodeSet.h"
#include "TaskObjectName.h"
// forward
namespace Gui { namespace TaskView { class TaskSelectLinkProperty;}}
namespace FemGui {
/// simulation dialog for the TaskView
class TaskDlgCreateNodeSet : public Gui::TaskView::TaskDialog
{
Q_OBJECT
public:
TaskDlgCreateNodeSet(Fem::FemSetNodesObject *);
~TaskDlgCreateNodeSet();
public:
/// is called the TaskView when the dialog is opened
virtual void open();
/// is called by the framework if the dialog is accepted (Ok)
virtual bool accept();
/// is called by the framework if the dialog is rejected (Cancel)
virtual bool reject();
/// is called by the framework if the user press the help button
virtual void helpRequested();
/// returns for Close and Help button
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
{ return QDialogButtonBox::Ok|QDialogButtonBox::Cancel; }
protected:
TaskCreateNodeSet *param;
TaskObjectName *name;
Fem::FemSetNodesObject *FemSetNodesObject;
};
} //namespace RobotGui
#endif // ROBOTGUI_TASKDLGSIMULATE_H

View File

@ -0,0 +1,109 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include <QString>
#include <QSlider>
#include "ui_TaskObjectName.h"
#include "TaskObjectName.h"
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <App/DocumentObject.h>
#include <Gui/BitmapFactory.h>
#include <Gui/ViewProvider.h>
#include <Gui/WaitCursor.h>
#include <Base/Console.h>
#include <Gui/Selection.h>
using namespace FemGui;
using namespace Gui;
TaskObjectName::TaskObjectName(App::DocumentObject *pcObject,QWidget *parent)
: TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh"),
tr("TaskObjectName"),
true,
parent),
pcObject(pcObject)
{
// we need a separate container widget to add all controls to
proxy = new QWidget(this);
ui = new Ui_TaskObjectName();
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
this->groupLayout()->addWidget(proxy);
//QObject::connect(ui->pushButton_HideShow,SIGNAL(clicked()),this,SLOT(hideShow()));
//QObject::connect(ui->doubleSpinBoxSizing,SIGNAL(valueChanged (double)),this,SLOT(sizingValueChanged(double)));
//QObject::connect(ui->checkBoxOrientation,SIGNAL(toggled (bool)),this,SLOT(orientationToggled(bool)));
}
//void TaskObjectName::setHideShowObject(void)
//{
// HideShowObj = pcObject->Source.getValue();
//
// if(HideShowObj){
// QString ObjectName = QString::fromUtf8(HideShowObj->Label.getValue());
// ui->lineEdit_ObjectName->setText(ObjectName);
// }else{
// ui->lineEdit_ObjectName->setText(QString());
// }
//}
//
//void TaskObjectName::hideShow(void)
//{
// setHideShowObject();
//
// if(HideShowObj){
// Gui::Document* doc = Gui::Application::Instance->activeDocument();
// if(doc->getViewProvider(HideShowObj)->isVisible())
// doc->getViewProvider(HideShowObj)->setVisible(false);
// else
// doc->getViewProvider(HideShowObj)->setVisible(true);
// }
//}
//
//void TaskObjectName::sizingValueChanged(double Value)
//{
// pcObject->SegValue.setValue(Value);
//}
//
//void TaskObjectName::orientationToggled(bool Value)
//{
// pcObject->UseRotation.setValue(Value);
//}
//
TaskObjectName::~TaskObjectName()
{
delete ui;
}
#include "moc_TaskObjectName.cpp"

View File

@ -0,0 +1,72 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_TASKVIEW_TaskObjectName_H
#define GUI_TASKVIEW_TaskObjectName_H
#include <Gui/TaskView/TaskView.h>
class Ui_TaskObjectName;
namespace App {
class Property;
class DocumentObject;
}
namespace Gui {
class ViewProvider;
}
namespace FemGui {
class TaskObjectName : public Gui::TaskView::TaskBox
{
Q_OBJECT
public:
TaskObjectName(App::DocumentObject *pcObject,QWidget *parent = 0);
~TaskObjectName();
private Q_SLOTS:
//void hideShow(void);
//void sizingValueChanged(double Value);
//void orientationToggled(bool Value);
protected:
App::DocumentObject *pcObject;
private:
private:
QWidget* proxy;
Ui_TaskObjectName* ui;
};
} //namespace FemGui
#endif // GUI_TASKVIEW_TaskObjectName_H

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskObjectName</class>
<widget class="QWidget" name="TaskObjectName">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>200</width>
<height>40</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_ObjectName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -176,7 +176,6 @@ ViewProviderFemMesh::ViewProviderFemMesh()
ADD_PROPERTY(BackfaceCulling,(true));
ADD_PROPERTY(ShowInner, (false));
ADD_PROPERTY(HighlightedNodes,());
pcDrawStyle = new SoDrawStyle();
pcDrawStyle->ref();
@ -241,7 +240,8 @@ void ViewProviderFemMesh::attach(App::DocumentObject *pcObj)
pcAnoStyle->pointSize = 5;
SoMaterial * pcAnoMaterial = new SoMaterial;
pcAnoMaterial->diffuseColor.setValue(0,1,0);
pcAnoMaterial->emissiveColor.setValue(0,1,0);
pcAnotRoot->addChild(pcAnoMaterial);
pcAnotRoot->addChild(pcAnoStyle);
pcAnotRoot->addChild(pcAnoCoords);
@ -378,29 +378,38 @@ void ViewProviderFemMesh::onChanged(const App::Property* prop)
else if (prop == &LineWidth) {
pcDrawStyle->lineWidth = LineWidth.getValue();
}
else if (prop == &HighlightedNodes) {
if(HighlightedNodes.getValues().size()){
const Fem::PropertyFemMesh* mesh = static_cast<const Fem::PropertyFemMesh*>(prop);
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>((dynamic_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh).getValue().getSMesh())->GetMeshDS();
pcAnoCoords->point.setNum(HighlightedNodes.getValues().size());
SbVec3f* verts = pcAnoCoords->point.startEditing();
int i=0;
for(std::set<long>::const_iterator it=HighlightedNodes.getValues().begin();it!=HighlightedNodes.getValues().end();++it,i++){
const SMDS_MeshNode *Node = data->FindNode(*it);
verts[i].setValue((float)Node->X(),(float)Node->Y(),(float)Node->Z());
}
pcAnoCoords->point.finishEditing();
}else{
pcAnoCoords->point.setNum(0);
}
}
else {
ViewProviderGeometryObject::onChanged(prop);
}
}
void ViewProviderFemMesh::setHighlightNodes(const std::set<long>& HighlightedNodes)
{
if(HighlightedNodes.size()){
const Fem::PropertyFemMesh* mesh = &(dynamic_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh);
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>((dynamic_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh).getValue().getSMesh())->GetMeshDS();
pcAnoCoords->point.setNum(HighlightedNodes.size());
SbVec3f* verts = pcAnoCoords->point.startEditing();
int i=0;
for(std::set<long>::const_iterator it=HighlightedNodes.begin();it!=HighlightedNodes.end();++it,i++){
const SMDS_MeshNode *Node = data->FindNode(*it);
verts[i].setValue((float)Node->X(),(float)Node->Y(),(float)Node->Z());
}
pcAnoCoords->point.finishEditing();
}else{
pcAnoCoords->point.setNum(0);
}
}
void ViewProviderFemMesh::resetHighlightNodes(void)
{
pcAnoCoords->point.setNum(0);
}
// ----------------------------------------------------------------------------
void ViewProviderFEMMeshBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& nodes) const

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -64,13 +64,16 @@ public:
App::PropertyMaterial PointMaterial;
App::PropertyBool BackfaceCulling;
App::PropertyBool ShowInner;
App::PropertyIntegerSet HighlightedNodes;
void attach(App::DocumentObject *pcObject);
void setDisplayMode(const char* ModeName);
std::vector<std::string> getDisplayModes() const;
void updateData(const App::Property*);
// interface methodes
void setHighlightNodes(const std::set<long>&);
void resetHighlightNodes(void);
private:
static App::PropertyFloatConstraint::Constraints floatRange;

View File

@ -0,0 +1,56 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "ViewProviderSetElements.h"
#include <Gui/Control.h>
using namespace Gui;
using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderSetElements, Gui::ViewProviderGeometryObject)
bool ViewProviderSetElements::doubleClicked(void)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
bool ViewProviderSetElements::setEdit(int ModNum)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
void ViewProviderSetElements::unsetEdit(int ModNum)
{
}

View File

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_ViewProviderSetElements_H
#define FEM_ViewProviderSetElements_H
#include "ViewProviderSetElements.h"
#include <Gui/ViewProviderGeometryObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
namespace FemGui
{
class ViewProviderSetElements : public Gui::ViewProviderGeometryObject
{
PROPERTY_HEADER(RobotGui::ViewProviderSetElements);
public:
virtual bool doubleClicked(void);
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
};
} //namespace FemGui
#endif // FEM_ViewProviderSetElements_H

View File

@ -0,0 +1,56 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "ViewProviderSetFaces.h"
#include <Gui/Control.h>
using namespace Gui;
using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderSetFaces, Gui::ViewProviderGeometryObject)
bool ViewProviderSetFaces::doubleClicked(void)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
bool ViewProviderSetFaces::setEdit(int ModNum)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
void ViewProviderSetFaces::unsetEdit(int ModNum)
{
}

View File

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_ViewProviderSetFaces_H
#define FEM_ViewProviderSetFaces_H
#include "ViewProviderSetFaces.h"
#include <Gui/ViewProviderGeometryObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
namespace FemGui
{
class ViewProviderSetFaces : public Gui::ViewProviderGeometryObject
{
PROPERTY_HEADER(RobotGui::ViewProviderSetFaces);
public:
virtual bool doubleClicked(void);
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
};
} //namespace FemGui
#endif // FEM_ViewProviderSetFaces_H

View File

@ -0,0 +1,56 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "ViewProviderSetGeometry.h"
#include <Gui/Control.h>
using namespace Gui;
using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderSetGeometry, Gui::ViewProviderGeometryObject)
bool ViewProviderSetGeometry::doubleClicked(void)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
bool ViewProviderSetGeometry::setEdit(int ModNum)
{
//Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
//Gui::Control().showDialog(dlg);
return true;
}
void ViewProviderSetGeometry::unsetEdit(int ModNum)
{
}

View File

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_ViewProviderSetGeometry_H
#define FEM_ViewProviderSetGeometry_H
#include "ViewProviderSetGeometry.h"
#include <Gui/ViewProviderGeometryObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
namespace FemGui
{
class ViewProviderSetGeometry : public Gui::ViewProviderGeometryObject
{
PROPERTY_HEADER(RobotGui::ViewProviderSetGeometry);
public:
virtual bool doubleClicked(void);
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
};
} //namespace FemGui
#endif // FEM_ViewProviderSetGeometry_H

View File

@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "ViewProviderSetNodes.h"
#include <Gui/Control.h>
#include <Mod/Fem/Gui/TaskDlgCreateNodeSet.h>
using namespace Gui;
using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderSetNodes, Gui::ViewProviderGeometryObject)
bool ViewProviderSetNodes::doubleClicked(void)
{
Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
Gui::Control().showDialog(dlg);
return true;
}
bool ViewProviderSetNodes::setEdit(int ModNum)
{
Gui::TaskView::TaskDialog* dlg = new TaskDlgCreateNodeSet(dynamic_cast<Fem::FemSetNodesObject *>(getObject()));
Gui::Control().showDialog(dlg);
return true;
}
void ViewProviderSetNodes::unsetEdit(int ModNum)
{
}

View File

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_ViewProviderSetNodes_H
#define FEM_ViewProviderSetNodes_H
#include "ViewProviderSetNodes.h"
#include <Gui/ViewProviderGeometryObject.h>
#include <Mod/Fem/App/FemSetNodesObject.h>
namespace FemGui
{
class ViewProviderSetNodes : public Gui::ViewProviderGeometryObject
{
PROPERTY_HEADER(RobotGui::ViewProviderSetNodes);
public:
virtual bool doubleClicked(void);
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
};
} //namespace FemGui
#endif // FEM_ViewProviderSetNodes_H

View File

@ -56,6 +56,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* fem = new Gui::ToolBarItem(root);
fem->setCommand("FEM");
*fem << "Fem_CreateFromShape"
<< "Fem_CreateNodesSet"
<< "Fem_DefineNodesSet";
return root;
}
@ -68,6 +69,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
root->insertItem(item, fem);
fem->setCommand("&FEM");
*fem << "Fem_CreateFromShape"
<< "Fem_CreateNodesSet"
<< "Fem_DefineNodesSet";
return root;