From 2818bc4ddf93a98889477bbecb193eae5bb45fb2 Mon Sep 17 00:00:00 2001 From: jriegel Date: Sat, 6 Apr 2013 23:08:23 +0200 Subject: [PATCH] Add ViewProvider and Dialogs for Analysis object and the Netgen mesher object --- src/Mod/Fem/App/CMakeLists.txt | 7 +- src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp | 122 +++++++ src/Mod/Fem/App/FemMeshShapeNetgenObject.h | 62 ++++ src/Mod/Fem/App/FemMeshShapeObject.cpp | 320 ++++++++---------- src/Mod/Fem/App/FemMeshShapeObject.h | 6 +- src/Mod/Fem/Driver/Standard-Calculix.py | 0 src/Mod/Fem/Gui/CMakeLists.txt | 29 +- src/Mod/Fem/Gui/TaskAnalysisInfo.cpp | 85 +++++ src/Mod/Fem/Gui/TaskAnalysisInfo.h | 78 +++++ src/Mod/Fem/Gui/TaskAnalysisInfo.ui | 59 ++++ src/Mod/Fem/Gui/TaskDlgAnalysis.cpp | 118 +++++++ src/Mod/Fem/Gui/TaskDlgAnalysis.h | 72 ++++ src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp | 114 +++++++ src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h | 71 ++++ src/Mod/Fem/Gui/TaskDriver.cpp | 95 ++++++ src/Mod/Fem/Gui/TaskDriver.h | 79 +++++ src/Mod/Fem/Gui/TaskDriver.ui | 33 ++ src/Mod/Fem/Gui/TaskTetParameter.cpp | 94 +++++ src/Mod/Fem/Gui/TaskTetParameter.h | 76 +++++ src/Mod/Fem/Gui/TaskTetParameter.ui | 148 ++++++++ src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 58 ++++ src/Mod/Fem/Gui/ViewProviderAnalysis.h | 58 ++++ src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp | 51 +++ src/Mod/Fem/Gui/ViewProviderFemMeshShape.h | 58 ++++ .../Gui/ViewProviderFemMeshShapeNetgen.cpp | 54 +++ .../Fem/Gui/ViewProviderFemMeshShapeNetgen.h | 58 ++++ 26 files changed, 1817 insertions(+), 188 deletions(-) create mode 100644 src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp create mode 100644 src/Mod/Fem/App/FemMeshShapeNetgenObject.h create mode 100644 src/Mod/Fem/Driver/Standard-Calculix.py create mode 100644 src/Mod/Fem/Gui/TaskAnalysisInfo.cpp create mode 100644 src/Mod/Fem/Gui/TaskAnalysisInfo.h create mode 100644 src/Mod/Fem/Gui/TaskAnalysisInfo.ui create mode 100644 src/Mod/Fem/Gui/TaskDlgAnalysis.cpp create mode 100644 src/Mod/Fem/Gui/TaskDlgAnalysis.h create mode 100644 src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp create mode 100644 src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h create mode 100644 src/Mod/Fem/Gui/TaskDriver.cpp create mode 100644 src/Mod/Fem/Gui/TaskDriver.h create mode 100644 src/Mod/Fem/Gui/TaskDriver.ui create mode 100644 src/Mod/Fem/Gui/TaskTetParameter.cpp create mode 100644 src/Mod/Fem/Gui/TaskTetParameter.h create mode 100644 src/Mod/Fem/Gui/TaskTetParameter.ui create mode 100644 src/Mod/Fem/Gui/ViewProviderAnalysis.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderAnalysis.h create mode 100644 src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderFemMeshShape.h create mode 100644 src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp create mode 100644 src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.h diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index c2358e2ae..4c6c98589 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -54,6 +54,8 @@ SET(FemBase_SRCS FemMeshObject.h FemMeshShapeObject.cpp FemMeshShapeObject.h + FemMeshShapeNetgenObject.cpp + FemMeshShapeNetgenObject.h FemAnalysis.cpp FemAnalysis.h FemMesh.cpp @@ -102,6 +104,7 @@ SET(Fem_SRCS ${Python_SRCS} ) +FILE( GLOB Driver_Resources Driver/*.py ) add_library(Fem SHARED ${Fem_SRCS}) @@ -111,10 +114,12 @@ target_link_libraries(Fem ${Fem_LIBS}) fc_target_copy_resource(Fem ${CMAKE_SOURCE_DIR}/src/Mod/Fem ${CMAKE_BINARY_DIR}/Mod/Fem - Init.py + ${Driver_Resources} + Init.py convert2TetGen.py FemLib.py) + if(MSVC) set_target_properties(Fem PROPERTIES SUFFIX ".pyd") set_target_properties(Fem PROPERTIES DEBUG_OUTPUT_NAME "Fem_d") diff --git a/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp b/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp new file mode 100644 index 000000000..a1a443289 --- /dev/null +++ b/src/Mod/Fem/App/FemMeshShapeNetgenObject.cpp @@ -0,0 +1,122 @@ +/*************************************************************************** + * 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 "FemMeshShapeNetgenObject.h" +#include "FemMesh.h" +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +using namespace Fem; +using namespace App; + +PROPERTY_SOURCE(Fem::FemMeshShapeNetgenObject, Fem::FemMeshShapeObject) + + +FemMeshShapeNetgenObject::FemMeshShapeNetgenObject() +{ + //ADD_PROPERTY_TYPE(Shape,(0), "Shape",Prop_None,"Shape for the analysis"); +} + +FemMeshShapeNetgenObject::~FemMeshShapeNetgenObject() +{ +} + +App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void) +{ + Fem::FemMesh newMesh; + + Part::Feature *feat = Shape.getValue(); + TopoDS_Shape shape = feat->Shape.getValue(); + + NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true); + + //NETGENPlugin_SimpleHypothesis_2D * tet2 = new NETGENPlugin_SimpleHypothesis_2D(hyp++,1,myGen); + //static_cast(tet2.get())->SetNumberOfSegments(5); + //static_cast(tet2.get())->SetLocalLength(0.1); + //static_cast(tet2.get())->LengthFromEdges(); + //myNetGenMesher.SetParameters(tet2); + + //NETGENPlugin_SimpleHypothesis_3D* tet= new NETGENPlugin_SimpleHypothesis_3D(hyp++,1,myGen); + //static_cast(tet.get())->LengthFromFaces(); + //static_cast(tet.get())->SetMaxElementVolume(0.1); + //myNetGenMesher.SetParameters( tet); + + myNetGenMesher.Compute(); + + + + SMESHDS_Mesh* data = const_cast(newMesh.getSMesh())->GetMeshDS(); + const SMDS_MeshInfo& info = data->GetMeshInfo(); + int numNode = info.NbNodes(); + int numTria = info.NbTriangles(); + int numQuad = info.NbQuadrangles(); + int numPoly = info.NbPolygons(); + int numVolu = info.NbVolumes(); + int numTetr = info.NbTetras(); + int numHexa = info.NbHexas(); + int numPyrd = info.NbPyramids(); + int numPris = info.NbPrisms(); + int numHedr = info.NbPolyhedrons(); + + // set the value to the object + FemMesh.setValue(newMesh); + + + return App::DocumentObject::StdReturn; +} + +//short FemMeshShapeNetgenObject::mustExecute(void) const +//{ +// return 0; +//} + +//PyObject *FemMeshShapeNetgenObject::getPyObject() +//{ +// if (PythonObject.is(Py::_None())){ +// // ref counter is set to 1 +// PythonObject = Py::Object(new DocumentObjectPy(this),true); +// } +// return Py::new_reference_to(PythonObject); +//} + +void FemMeshShapeNetgenObject::onChanged(const Property* prop) +{ + App::GeoFeature::onChanged(prop); +} diff --git a/src/Mod/Fem/App/FemMeshShapeNetgenObject.h b/src/Mod/Fem/App/FemMeshShapeNetgenObject.h new file mode 100644 index 000000000..23b3aec62 --- /dev/null +++ b/src/Mod/Fem/App/FemMeshShapeNetgenObject.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * 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_FemMeshShapeNetgenObject_H +#define Fem_FemMeshShapeNetgenObject_H + + +#include "FemMesh.h" +#include "FemMeshShapeObject.h" + +namespace Fem +{ + +class AppFemExport FemMeshShapeNetgenObject : public FemMeshShapeObject +{ + PROPERTY_HEADER(Fem::FemMeshShapeNetgenObject); + +public: + /// Constructor + FemMeshShapeNetgenObject(void); + virtual ~FemMeshShapeNetgenObject(); + + /// returns the type name of the ViewProvider + virtual const char* getViewProviderName(void) const { + return "FemGui::ViewProviderFemMeshShapeNetgen"; + } + virtual App::DocumentObjectExecReturn *execute(void); + + //virtual short mustExecute(void) const; + //virtual PyObject *getPyObject(void); + + //App::PropertyLink Shape; + +protected: + /// get called by the container when a property has changed + virtual void onChanged (const App::Property* prop); +}; + +} //namespace Fem + + +#endif // Fem_FemMeshShapeNetgenObject_H diff --git a/src/Mod/Fem/App/FemMeshShapeObject.cpp b/src/Mod/Fem/App/FemMeshShapeObject.cpp index 9fec365a5..ca1bbcd7a 100644 --- a/src/Mod/Fem/App/FemMeshShapeObject.cpp +++ b/src/Mod/Fem/App/FemMeshShapeObject.cpp @@ -32,50 +32,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include - -#include -#include - using namespace Fem; using namespace App; @@ -91,140 +47,140 @@ FemMeshShapeObject::~FemMeshShapeObject() { } -App::DocumentObjectExecReturn *FemMeshShapeObject::execute(void) -{ - Fem::FemMesh newMesh; - - Part::Feature *feat = Shape.getValue(); - -#if 0 - TopoDS_Shape oshape = feat->Shape.getValue(); - BRepBuilderAPI_Copy copy(oshape); - const TopoDS_Shape& shape = copy.Shape(); - BRepTools::Clean(shape); // remove triangulation -#else - TopoDS_Shape shape = feat->Shape.getValue(); -#endif - - newMesh.getSMesh()->ShapeToMesh(shape); - SMESH_Gen *myGen = newMesh.getGenerator(); - - int hyp=0; -#if 0 - SMESH_HypothesisPtr len(new StdMeshers_MaxLength(hyp++, 1, myGen)); - static_cast(len.get())->SetLength(1.0); - newMesh.addHypothesis(shape, len); - - SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen)); - static_cast(loc.get())->SetLength(1.0); - newMesh.addHypothesis(shape, loc); - - SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen)); - static_cast(area.get())->SetMaxArea(1.0); - newMesh.addHypothesis(shape, area); - - SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen)); - static_cast(segm.get())->SetNumberOfSegments(1); - newMesh.addHypothesis(shape, segm); - - SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen)); - static_cast(defl.get())->SetDeflection(0.01); - newMesh.addHypothesis(shape, defl); - - SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, myGen)); - newMesh.addHypothesis(shape, reg); - - //SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, myGen)); - //static_cast(sel.get())->SetLength(1.0, true); - //newMesh.addHypothesis(shape, sel; - - SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++,1,myGen)); - newMesh.addHypothesis(shape, qdp); - - //SMESH_HypothesisPtr q2d(new StdMeshers_Quadrangle_2D(hyp++,1,myGen)); - //newMesh.addHypothesis(shape, q2d); - - SMESH_HypothesisPtr h3d(new StdMeshers_Hexa_3D(hyp++,1,myGen)); - newMesh.addHypothesis(shape, h3d); - - // create mesh - newMesh.compute(); -#endif -#if 0 // Surface quad mesh - SMESH_HypothesisPtr len(new StdMeshers_MaxLength(hyp++, 1, myGen)); - static_cast(len.get())->SetLength(1.0); - newMesh.addHypothesis(shape, len); - - SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen)); - static_cast(loc.get())->SetLength(1.0); - newMesh.addHypothesis(shape, loc); - - SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen)); - static_cast(area.get())->SetMaxArea(1.0); - newMesh.addHypothesis(shape, area); - - SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen)); - static_cast(segm.get())->SetNumberOfSegments(1); - newMesh.addHypothesis(shape, segm); - - SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen)); - static_cast(defl.get())->SetDeflection(0.01); - newMesh.addHypothesis(shape, defl); - - SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, myGen)); - newMesh.addHypothesis(shape, reg); - - //SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, myGen)); - //static_cast(sel.get())->SetLength(1.0, true); - //newMesh.addHypothesis(shape, sel; - - SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++,1,myGen)); - newMesh.addHypothesis(shape, qdp); - - SMESH_HypothesisPtr q2d(new StdMeshers_Quadrangle_2D(hyp++,1,myGen)); - newMesh.addHypothesis(shape, q2d); - - // create mesh - newMesh.compute(); -#endif -#if 1 // NETGEN test - NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true); - - //NETGENPlugin_SimpleHypothesis_2D * tet2 = new NETGENPlugin_SimpleHypothesis_2D(hyp++,1,myGen); - //static_cast(tet2.get())->SetNumberOfSegments(5); - //static_cast(tet2.get())->SetLocalLength(0.1); - //static_cast(tet2.get())->LengthFromEdges(); - //myNetGenMesher.SetParameters(tet2); - - //NETGENPlugin_SimpleHypothesis_3D* tet= new NETGENPlugin_SimpleHypothesis_3D(hyp++,1,myGen); - //static_cast(tet.get())->LengthFromFaces(); - //static_cast(tet.get())->SetMaxElementVolume(0.1); - //myNetGenMesher.SetParameters( tet); - - myNetGenMesher.Compute(); -#endif - - - - SMESHDS_Mesh* data = const_cast(newMesh.getSMesh())->GetMeshDS(); - const SMDS_MeshInfo& info = data->GetMeshInfo(); - int numNode = info.NbNodes(); - int numTria = info.NbTriangles(); - int numQuad = info.NbQuadrangles(); - int numPoly = info.NbPolygons(); - int numVolu = info.NbVolumes(); - int numTetr = info.NbTetras(); - int numHexa = info.NbHexas(); - int numPyrd = info.NbPyramids(); - int numPris = info.NbPrisms(); - int numHedr = info.NbPolyhedrons(); - - // set the value to the object - FemMesh.setValue(newMesh); - - - return App::DocumentObject::StdReturn; -} +//App::DocumentObjectExecReturn *FemMeshShapeObject::execute(void) +//{ +// Fem::FemMesh newMesh; +// +// Part::Feature *feat = Shape.getValue(); +// +//#if 0 +// TopoDS_Shape oshape = feat->Shape.getValue(); +// BRepBuilderAPI_Copy copy(oshape); +// const TopoDS_Shape& shape = copy.Shape(); +// BRepTools::Clean(shape); // remove triangulation +//#else +// TopoDS_Shape shape = feat->Shape.getValue(); +//#endif +// +// newMesh.getSMesh()->ShapeToMesh(shape); +// SMESH_Gen *myGen = newMesh.getGenerator(); +// +// int hyp=0; +//#if 0 +// SMESH_HypothesisPtr len(new StdMeshers_MaxLength(hyp++, 1, myGen)); +// static_cast(len.get())->SetLength(1.0); +// newMesh.addHypothesis(shape, len); +// +// SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen)); +// static_cast(loc.get())->SetLength(1.0); +// newMesh.addHypothesis(shape, loc); +// +// SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen)); +// static_cast(area.get())->SetMaxArea(1.0); +// newMesh.addHypothesis(shape, area); +// +// SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen)); +// static_cast(segm.get())->SetNumberOfSegments(1); +// newMesh.addHypothesis(shape, segm); +// +// SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen)); +// static_cast(defl.get())->SetDeflection(0.01); +// newMesh.addHypothesis(shape, defl); +// +// SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, myGen)); +// newMesh.addHypothesis(shape, reg); +// +// //SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, myGen)); +// //static_cast(sel.get())->SetLength(1.0, true); +// //newMesh.addHypothesis(shape, sel; +// +// SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++,1,myGen)); +// newMesh.addHypothesis(shape, qdp); +// +// //SMESH_HypothesisPtr q2d(new StdMeshers_Quadrangle_2D(hyp++,1,myGen)); +// //newMesh.addHypothesis(shape, q2d); +// +// SMESH_HypothesisPtr h3d(new StdMeshers_Hexa_3D(hyp++,1,myGen)); +// newMesh.addHypothesis(shape, h3d); +// +// // create mesh +// newMesh.compute(); +//#endif +//#if 0 // Surface quad mesh +// SMESH_HypothesisPtr len(new StdMeshers_MaxLength(hyp++, 1, myGen)); +// static_cast(len.get())->SetLength(1.0); +// newMesh.addHypothesis(shape, len); +// +// SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen)); +// static_cast(loc.get())->SetLength(1.0); +// newMesh.addHypothesis(shape, loc); +// +// SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen)); +// static_cast(area.get())->SetMaxArea(1.0); +// newMesh.addHypothesis(shape, area); +// +// SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen)); +// static_cast(segm.get())->SetNumberOfSegments(1); +// newMesh.addHypothesis(shape, segm); +// +// SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen)); +// static_cast(defl.get())->SetDeflection(0.01); +// newMesh.addHypothesis(shape, defl); +// +// SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, myGen)); +// newMesh.addHypothesis(shape, reg); +// +// //SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, myGen)); +// //static_cast(sel.get())->SetLength(1.0, true); +// //newMesh.addHypothesis(shape, sel; +// +// SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++,1,myGen)); +// newMesh.addHypothesis(shape, qdp); +// +// SMESH_HypothesisPtr q2d(new StdMeshers_Quadrangle_2D(hyp++,1,myGen)); +// newMesh.addHypothesis(shape, q2d); +// +// // create mesh +// newMesh.compute(); +//#endif +//#if 1 // NETGEN test +// NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true); +// +// //NETGENPlugin_SimpleHypothesis_2D * tet2 = new NETGENPlugin_SimpleHypothesis_2D(hyp++,1,myGen); +// //static_cast(tet2.get())->SetNumberOfSegments(5); +// //static_cast(tet2.get())->SetLocalLength(0.1); +// //static_cast(tet2.get())->LengthFromEdges(); +// //myNetGenMesher.SetParameters(tet2); +// +// //NETGENPlugin_SimpleHypothesis_3D* tet= new NETGENPlugin_SimpleHypothesis_3D(hyp++,1,myGen); +// //static_cast(tet.get())->LengthFromFaces(); +// //static_cast(tet.get())->SetMaxElementVolume(0.1); +// //myNetGenMesher.SetParameters( tet); +// +// myNetGenMesher.Compute(); +//#endif +// +// +// +// SMESHDS_Mesh* data = const_cast(newMesh.getSMesh())->GetMeshDS(); +// const SMDS_MeshInfo& info = data->GetMeshInfo(); +// int numNode = info.NbNodes(); +// int numTria = info.NbTriangles(); +// int numQuad = info.NbQuadrangles(); +// int numPoly = info.NbPolygons(); +// int numVolu = info.NbVolumes(); +// int numTetr = info.NbTetras(); +// int numHexa = info.NbHexas(); +// int numPyrd = info.NbPyramids(); +// int numPris = info.NbPrisms(); +// int numHedr = info.NbPolyhedrons(); +// +// // set the value to the object +// FemMesh.setValue(newMesh); +// +// +// return App::DocumentObject::StdReturn; +//} //short FemMeshShapeObject::mustExecute(void) const //{ @@ -240,7 +196,7 @@ App::DocumentObjectExecReturn *FemMeshShapeObject::execute(void) // return Py::new_reference_to(PythonObject); //} -void FemMeshShapeObject::onChanged(const Property* prop) -{ - App::GeoFeature::onChanged(prop); -} +//void FemMeshShapeObject::onChanged(const Property* prop) +//{ +// App::GeoFeature::onChanged(prop); +//} diff --git a/src/Mod/Fem/App/FemMeshShapeObject.h b/src/Mod/Fem/App/FemMeshShapeObject.h index cebf282b8..cac434eb8 100644 --- a/src/Mod/Fem/App/FemMeshShapeObject.h +++ b/src/Mod/Fem/App/FemMeshShapeObject.h @@ -25,9 +25,7 @@ #define Fem_FemMeshShapeObject_H -#include "FemMesh.h" #include "FemMeshObject.h" -#include "FemMeshProperty.h" namespace Fem { @@ -45,7 +43,7 @@ public: //virtual const char* getViewProviderName(void) const { // return "FemGui::ViewProviderFemMeshShape"; //} - virtual App::DocumentObjectExecReturn *execute(void); + //virtual App::DocumentObjectExecReturn *execute(void); //virtual short mustExecute(void) const; //virtual PyObject *getPyObject(void); @@ -54,7 +52,7 @@ public: protected: /// get called by the container when a property has changed - virtual void onChanged (const App::Property* prop); + //virtual void onChanged (const App::Property* prop); }; } //namespace Fem diff --git a/src/Mod/Fem/Driver/Standard-Calculix.py b/src/Mod/Fem/Driver/Standard-Calculix.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt index cd4e3ee05..6dc46ff7e 100755 --- a/src/Mod/Fem/Gui/CMakeLists.txt +++ b/src/Mod/Fem/Gui/CMakeLists.txt @@ -36,6 +36,11 @@ set(FemGui_MOC_HDRS TaskFemConstraintForce.h TaskFemConstraintGear.h TaskFemConstraintPulley.h + TaskTetParameter.h + TaskAnalysisInfo.h + TaskDriver.h + TaskDlgAnalysis.h + TaskDlgMeshShapeNetgen.h ) fc_wrap_cpp(FemGui_MOC_SRCS ${FemGui_MOC_HDRS}) SOURCE_GROUP("Moc" FILES ${FemGui_MOC_SRCS}) @@ -48,6 +53,9 @@ set(FemGui_UIC_SRCS TaskFemConstraintBearing.ui TaskFemConstraintFixed.ui TaskFemConstraintForce.ui + TaskTetParameter.ui + TaskAnalysisInfo.ui + TaskDriver.ui ) qt4_wrap_ui(FemGui_UIC_HDRS ${FemGui_UIC_SRCS}) @@ -73,7 +81,7 @@ SET(FemGui_DLG_SRCS TaskFemConstraintPulley.cpp TaskFemConstraintPulley.h ) -SOURCE_GROUP("Dialogs" FILES ${FemGui_DLG_SRCS}) +SOURCE_GROUP("Constraint-Dialogs" FILES ${FemGui_DLG_SRCS}) qt4_add_resources(FemResource_SRCS Resources/Fem.qrc) @@ -82,6 +90,12 @@ SOURCE_GROUP("Resources" FILES ${FemResource_SRCS}) SET(FemGui_SRCS_ViewProvider ViewProviderFemMesh.cpp ViewProviderFemMesh.h + ViewProviderFemMeshShape.cpp + ViewProviderFemMeshShape.h + ViewProviderFemMeshShapeNetgen.cpp + ViewProviderFemMeshShapeNetgen.h + ViewProviderAnalysis.cpp + ViewProviderAnalysis.h ViewProviderSetNodes.cpp ViewProviderSetNodes.h ViewProviderSetElements.cpp @@ -114,12 +128,25 @@ SET(FemGui_SRCS_TaskBoxes TaskCreateNodeSet.ui TaskCreateNodeSet.cpp TaskCreateNodeSet.h + TaskDriver.ui + TaskDriver.cpp + TaskDriver.h + TaskAnalysisInfo.ui + TaskAnalysisInfo.cpp + TaskAnalysisInfo.h + TaskTetParameter.ui + TaskTetParameter.cpp + TaskTetParameter.h ) SOURCE_GROUP("Task_Boxes" FILES ${FemGui_SRCS_TaskBoxes}) SET(FemGui_SRCS_TaskDlg TaskDlgCreateNodeSet.h TaskDlgCreateNodeSet.cpp + TaskDlgMeshShapeNetgen.h + TaskDlgMeshShapeNetgen.cpp + TaskDlgAnalysis.h + TaskDlgAnalysis.cpp ) SOURCE_GROUP("Task_Dialogs" FILES ${FemGui_SRCS_TaskDlg}) diff --git a/src/Mod/Fem/Gui/TaskAnalysisInfo.cpp b/src/Mod/Fem/Gui/TaskAnalysisInfo.cpp new file mode 100644 index 000000000..107375d72 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskAnalysisInfo.cpp @@ -0,0 +1,85 @@ +/*************************************************************************** + * 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_ +# include +# include +#endif + +#include +#include "ui_TaskAnalysisInfo.h" +#include "TaskAnalysisInfo.h" +#include +#include +#include + + + +using namespace FemGui; +using namespace Gui; + + +TaskAnalysisInfo::TaskAnalysisInfo(Fem::FemAnalysis *pcObject,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh_createnodebypoly"), + 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_TaskAnalysisInfo(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + this->groupLayout()->addWidget(proxy); + + /* QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly())); + QObject::connect(ui->toolButton_Pick,SIGNAL(clicked()),this,SLOT(Pick())); + QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int)));*/ + +} + + +void TaskAnalysisInfo::SwitchMethod(int Value) +{ + /* if(Value == 1){ + ui->groupBox_AngleSearch->setEnabled(true); + ui->toolButton_Pick->setEnabled(true); + ui->toolButton_Poly->setEnabled(false); + }else{ + ui->groupBox_AngleSearch->setEnabled(false); + ui->toolButton_Pick->setEnabled(false); + ui->toolButton_Poly->setEnabled(true); + }*/ +} + + +TaskAnalysisInfo::~TaskAnalysisInfo() +{ + delete ui; +} + + +#include "moc_TaskAnalysisInfo.cpp" diff --git a/src/Mod/Fem/Gui/TaskAnalysisInfo.h b/src/Mod/Fem/Gui/TaskAnalysisInfo.h new file mode 100644 index 000000000..5dad4edaa --- /dev/null +++ b/src/Mod/Fem/Gui/TaskAnalysisInfo.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * 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 FEMGUI_TaskAnalysisInfo_H +#define FEMGUI_TaskAnalysisInfo_H + +#include +#include + +#include + + +class Ui_TaskAnalysisInfo; +class SoEventCallback; + +namespace Base { + class Polygon2D; +} +namespace App { + class Property; +} + +namespace Gui { +class ViewProvider; +class ViewVolumeProjection; +} + +namespace Fem{ + class FemAnalysis; +} + +namespace FemGui { + +class ViewProviderFemMesh; + + +class TaskAnalysisInfo : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskAnalysisInfo(Fem::FemAnalysis *pcObject,QWidget *parent = 0); + ~TaskAnalysisInfo(); + +private Q_SLOTS: + void SwitchMethod(int Value); + +protected: + Fem::FemAnalysis *pcObject; + +private: + QWidget* proxy; + Ui_TaskAnalysisInfo* ui; +}; + +} //namespace FEMGUI_TaskAnalysisInfo_H + +#endif // GUI_TASKVIEW_TaskAnalysisInfo_H diff --git a/src/Mod/Fem/Gui/TaskAnalysisInfo.ui b/src/Mod/Fem/Gui/TaskAnalysisInfo.ui new file mode 100644 index 000000000..9efb3bea2 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskAnalysisInfo.ui @@ -0,0 +1,59 @@ + + + TaskAnalysisInfo + + + + 0 + 0 + 196 + 448 + + + + + 0 + 0 + + + + Form + + + + + + + 75 + true + + + + Meshes: + + + + + + + + + + + 75 + true + + + + Constraints + + + + + + + + + + + diff --git a/src/Mod/Fem/Gui/TaskDlgAnalysis.cpp b/src/Mod/Fem/Gui/TaskDlgAnalysis.cpp new file mode 100644 index 000000000..c04d5ffb2 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgAnalysis.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + * 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 "TaskDlgAnalysis.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include "TaskAnalysisInfo.h" +#include "TaskDriver.h" + + +using namespace FemGui; + + +//************************************************************************** +//************************************************************************** +// TaskDialog +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TaskDlgAnalysis::TaskDlgAnalysis(Fem::FemAnalysis *obj) + : TaskDialog(),FemAnalysis(obj) +{ + driver = new TaskDriver(obj); + info = new TaskAnalysisInfo(obj); + + Content.push_back(driver); + Content.push_back(info); +} + +TaskDlgAnalysis::~TaskDlgAnalysis() +{ + +} + +//==== calls from the TaskView =============================================================== + + +void TaskDlgAnalysis::open() +{ + //select->activate(); + //Edge2TaskObject->execute(); + //param->setEdgeAndClusterNbr(Edge2TaskObject->NbrOfEdges,Edge2TaskObject->NbrOfCluster); + +} + +bool TaskDlgAnalysis::accept() +{ + //try { + // FemSetNodesObject->Nodes.setValues(param->tempSet); + // FemSetNodesObject->recompute(); + // //Gui::Document* doc = Gui::Application::Instance->activeDocument(); + // //if(doc) + // // doc->resetEdit(); + // param->MeshViewProvider->resetHighlightNodes(); + // FemSetNodesObject->Label.setValue(name->name); + // Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + + // return true; + //} + //catch (const Base::Exception& e) { + // Base::Console().Warning("TaskDlgAnalysis::accept(): %s\n", e.what()); + //} + + return false; +} + +bool TaskDlgAnalysis::reject() +{ + //FemSetNodesObject->execute(); + // //Gui::Document* doc = Gui::Application::Instance->activeDocument(); + // //if(doc) + // // doc->resetEdit(); + //param->MeshViewProvider->resetHighlightNodes(); + //Gui::Command::abortCommand(); + //Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + + return true; +} + +void TaskDlgAnalysis::helpRequested() +{ + +} + + +#include "moc_TaskDlgAnalysis.cpp" diff --git a/src/Mod/Fem/Gui/TaskDlgAnalysis.h b/src/Mod/Fem/Gui/TaskDlgAnalysis.h new file mode 100644 index 000000000..185008f21 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgAnalysis.h @@ -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 FEMGUI_TaskDlgAnalysis_H +#define FEMGUI_TaskDlgAnalysis_H + +#include + + +namespace Fem{ + class FemAnalysis; +} + +namespace FemGui { + class TaskAnalysisInfo ; + class TaskDriver; + +/// simulation dialog for the TaskView +class TaskDlgAnalysis : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgAnalysis(Fem::FemAnalysis *); + ~TaskDlgAnalysis(); + +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|QDialogButtonBox::Apply; } + +protected: + TaskAnalysisInfo *info; + TaskDriver *driver; + + Fem::FemAnalysis *FemAnalysis; +}; + + + +} //namespace FemGui + +#endif // FEMGUI_TaskDlgAnalysis_H diff --git a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp new file mode 100644 index 000000000..dc4b03bec --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp @@ -0,0 +1,114 @@ +/*************************************************************************** + * 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 "TaskDlgMeshShapeNetgen.h" + +#include +#include +#include +#include +#include +#include +#include "ViewProviderFemMesh.h" + +#include +#include "TaskTetParameter.h" + +using namespace FemGui; + + +//************************************************************************** +//************************************************************************** +// TaskDialog +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TaskDlgMeshShapeNetgen::TaskDlgMeshShapeNetgen(Fem::FemMeshShapeNetgenObject *obj) + : TaskDialog(),FemMeshShapeNetgenObject(obj) +{ + param = new TaskTetParameter(obj); + + Content.push_back(param); +} + +TaskDlgMeshShapeNetgen::~TaskDlgMeshShapeNetgen() +{ + +} + +//==== calls from the TaskView =============================================================== + + +void TaskDlgMeshShapeNetgen::open() +{ + //select->activate(); + //Edge2TaskObject->execute(); + //param->setEdgeAndClusterNbr(Edge2TaskObject->NbrOfEdges,Edge2TaskObject->NbrOfCluster); + +} + +bool TaskDlgMeshShapeNetgen::accept() +{ + //try { + // FemSetNodesObject->Nodes.setValues(param->tempSet); + // FemSetNodesObject->recompute(); + // //Gui::Document* doc = Gui::Application::Instance->activeDocument(); + // //if(doc) + // // doc->resetEdit(); + // param->MeshViewProvider->resetHighlightNodes(); + // FemSetNodesObject->Label.setValue(name->name); + // Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + + // return true; + //} + //catch (const Base::Exception& e) { + // Base::Console().Warning("TaskDlgMeshShapeNetgen::accept(): %s\n", e.what()); + //} + + return false; +} + +bool TaskDlgMeshShapeNetgen::reject() +{ + //FemSetNodesObject->execute(); + // //Gui::Document* doc = Gui::Application::Instance->activeDocument(); + // //if(doc) + // // doc->resetEdit(); + //param->MeshViewProvider->resetHighlightNodes(); + //Gui::Command::abortCommand(); + //Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()"); + + return true; +} + +void TaskDlgMeshShapeNetgen::helpRequested() +{ + +} + + +#include "moc_TaskDlgMeshShapeNetgen.cpp" diff --git a/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h new file mode 100644 index 000000000..395864996 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h @@ -0,0 +1,71 @@ +/*************************************************************************** + * 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 FEMGUI_TaskDlgMeshShapeNetgen_H +#define FEMGUI_TaskDlgMeshShapeNetgen_H + +#include + +namespace Fem { + class FemMeshShapeNetgenObject; +} + + +namespace FemGui { + +class TaskTetParameter; + +/// simulation dialog for the TaskView +class TaskDlgMeshShapeNetgen : public Gui::TaskView::TaskDialog +{ + Q_OBJECT + +public: + TaskDlgMeshShapeNetgen(Fem::FemMeshShapeNetgenObject *); + ~TaskDlgMeshShapeNetgen(); + +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: + TaskTetParameter *param; + + Fem::FemMeshShapeNetgenObject *FemMeshShapeNetgenObject; +}; + + + +} //namespace FemGui + +#endif // FEMGUI_TaskDlgMeshShapeNetgen_H diff --git a/src/Mod/Fem/Gui/TaskDriver.cpp b/src/Mod/Fem/Gui/TaskDriver.cpp new file mode 100644 index 000000000..3b1c8f9de --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDriver.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * 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_ +# include +# include +#endif + +#include +#include "ui_TaskDriver.h" +#include "TaskDriver.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +using namespace FemGui; +using namespace Gui; + + +TaskDriver::TaskDriver(Fem::FemAnalysis *pcObject,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh_createnodebypoly"), + 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_TaskDriver(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + this->groupLayout()->addWidget(proxy); + + //QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly())); + //QObject::connect(ui->toolButton_Pick,SIGNAL(clicked()),this,SLOT(Pick())); + //QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int))); + +} + + + +void TaskDriver::SwitchMethod(int Value) +{ + //if(Value == 1){ + // ui->groupBox_AngleSearch->setEnabled(true); + // ui->toolButton_Pick->setEnabled(true); + // ui->toolButton_Poly->setEnabled(false); + //}else{ + // ui->groupBox_AngleSearch->setEnabled(false); + // ui->toolButton_Pick->setEnabled(false); + // ui->toolButton_Poly->setEnabled(true); + //} +} + + + + + +TaskDriver::~TaskDriver() +{ + delete ui; +} + + +#include "moc_TaskDriver.cpp" diff --git a/src/Mod/Fem/Gui/TaskDriver.h b/src/Mod/Fem/Gui/TaskDriver.h new file mode 100644 index 000000000..c7f0b96af --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDriver.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * 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 FEMGUI_TaskDriver_H +#define FEMGUI_TaskDriver_H + +#include +#include + +#include + + +class Ui_TaskDriver; +class SoEventCallback; + +namespace Base { +class Polygon2D; +} +namespace App { +class Property; +} + +namespace Gui { +class ViewProvider; +class ViewVolumeProjection; +} + +namespace Fem{ + class FemAnalysis; +} + + + +namespace FemGui { + + +class TaskDriver : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskDriver(Fem::FemAnalysis *pcObject,QWidget *parent = 0); + ~TaskDriver(); + + +private Q_SLOTS: + void SwitchMethod(int Value); + +protected: + Fem::FemAnalysis *pcObject; + +private: + QWidget* proxy; + Ui_TaskDriver* ui; +}; + +} //namespace FemGui + +#endif // FEMGUI_TaskDriver_H diff --git a/src/Mod/Fem/Gui/TaskDriver.ui b/src/Mod/Fem/Gui/TaskDriver.ui new file mode 100644 index 000000000..f9dd82278 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskDriver.ui @@ -0,0 +1,33 @@ + + + TaskDriver + + + + 0 + 0 + 184 + 236 + + + + + 0 + 0 + + + + Form + + + + + + + + + + + + + diff --git a/src/Mod/Fem/Gui/TaskTetParameter.cpp b/src/Mod/Fem/Gui/TaskTetParameter.cpp new file mode 100644 index 000000000..05d318725 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskTetParameter.cpp @@ -0,0 +1,94 @@ +/*************************************************************************** + * 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_ +# include +# include +#endif + +#include +#include "ui_TaskTetParameter.h" +#include "TaskTetParameter.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace FemGui; +using namespace Gui; + + +TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject *pcObject,QWidget *parent) + : TaskBox(Gui::BitmapFactory().pixmap("Fem_FemMesh_createnodebypoly"), + tr("Tet Parameter"), + true, + parent), + pcObject(pcObject) +{ + // we need a separate container widget to add all controls to + proxy = new QWidget(this); + ui = new Ui_TaskTetParameter(); + ui->setupUi(proxy); + QMetaObject::connectSlotsByName(this); + + this->groupLayout()->addWidget(proxy); + + //QObject::connect(ui->toolButton_Poly,SIGNAL(clicked()),this,SLOT(Poly())); + //QObject::connect(ui->toolButton_Pick,SIGNAL(clicked()),this,SLOT(Pick())); + //QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int))); + + +} + +TaskTetParameter::~TaskTetParameter() +{ + delete ui; +} + +void TaskTetParameter::SwitchMethod(int Value) +{ + //if(Value == 1){ + // ui->groupBox_AngleSearch->setEnabled(true); + // ui->toolButton_Pick->setEnabled(true); + // ui->toolButton_Poly->setEnabled(false); + //}else{ + // ui->groupBox_AngleSearch->setEnabled(false); + // ui->toolButton_Pick->setEnabled(false); + // ui->toolButton_Poly->setEnabled(true); + //} +} + + + + + + + +#include "moc_TaskTetParameter.cpp" diff --git a/src/Mod/Fem/Gui/TaskTetParameter.h b/src/Mod/Fem/Gui/TaskTetParameter.h new file mode 100644 index 000000000..c14abb1c7 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskTetParameter.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * 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 FEMGUI_TaskTetParameter_H +#define FEMGUI_TaskTetParameter_H + +#include + + +class Ui_TaskTetParameter; +class SoEventCallback; + +namespace Base { +class Polygon2D; +} +namespace App { +class Property; +} + +namespace Gui { +class ViewProvider; +class ViewVolumeProjection; +} +namespace Fem{ + class FemMeshShapeNetgenObject; +} + +namespace FemGui { + +class ViewProviderFemMeshShapeNetgen; + + +class TaskTetParameter : public Gui::TaskView::TaskBox +{ + Q_OBJECT + +public: + TaskTetParameter(Fem::FemMeshShapeNetgenObject *pcObject,QWidget *parent = 0); + ~TaskTetParameter(); + + ViewProviderFemMeshShapeNetgen * MeshViewProvider; + +private Q_SLOTS: + void SwitchMethod(int Value); + +protected: + Fem::FemMeshShapeNetgenObject *pcObject; + +private: + QWidget* proxy; + Ui_TaskTetParameter* ui; +}; + +} //namespace FemGui + +#endif // FEMGUI_TaskTetParameter_H diff --git a/src/Mod/Fem/Gui/TaskTetParameter.ui b/src/Mod/Fem/Gui/TaskTetParameter.ui new file mode 100644 index 000000000..a72ea70d4 --- /dev/null +++ b/src/Mod/Fem/Gui/TaskTetParameter.ui @@ -0,0 +1,148 @@ + + + TaskTetParameter + + + + 0 + 0 + 221 + 196 + + + + + 0 + 0 + + + + Form + + + + + + + + Max. Size: + + + + + + + + + + + + Second order + + + + + + + + + Fineness: + + + + + + + 2 + + + + VeryCoarse + + + + + Coarse + + + + + Moderate + + + + + Fine + + + + + VeryFine + + + + + UserDefined + + + + + + + + Groth Rate: + + + + + + + false + + + + + + + Nbr. Segs per Edge: + + + + + + + false + + + + + + + Nbr. Segs per Radius: + + + + + + + false + + + + + + + + + Optimize + + + true + + + + + + + + diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp new file mode 100644 index 000000000..b47ad673b --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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_ +# include + +#endif + +#include "ViewProviderAnalysis.h" + +#include +#include + + +using namespace FemGui; + + + + + + + +PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderGeometryObject) + + +ViewProviderAnalysis::ViewProviderAnalysis() +{ + + +} + +ViewProviderAnalysis::~ViewProviderAnalysis() +{ + +} + diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.h b/src/Mod/Fem/Gui/ViewProviderAnalysis.h new file mode 100644 index 000000000..e066ce1d0 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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_ViewProviderAnalysis_H +#define FEM_ViewProviderAnalysis_H + +#include +#include + +class SoCoordinate3; +class SoDrawStyle; +class SoIndexedFaceSet; +class SoIndexedLineSet; +class SoShapeHints; +class SoMaterialBinding; + +namespace FemGui +{ + + + +class FemGuiExport ViewProviderAnalysis : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(FemGui::ViewProviderAnalysis); + +public: + /// constructor. + ViewProviderAnalysis(); + + /// destructor. + ~ViewProviderAnalysis(); + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderAnalysis_H diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp b/src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp new file mode 100644 index 000000000..e5cf69f23 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + * 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_ +# include + +#endif + +#include "ViewProviderFemMeshShape.h" + + +using namespace FemGui; + + + +PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShape, Gui::ViewProviderGeometryObject) + + +ViewProviderFemMeshShape::ViewProviderFemMeshShape() +{ + +} + +ViewProviderFemMeshShape::~ViewProviderFemMeshShape() +{ + +} + + diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshShape.h b/src/Mod/Fem/Gui/ViewProviderFemMeshShape.h new file mode 100644 index 000000000..579300176 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshShape.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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_ViewProviderFemMeshShape_H +#define FEM_ViewProviderFemMeshShape_H + +#include +#include + +class SoCoordinate3; +class SoDrawStyle; +class SoIndexedFaceSet; +class SoIndexedLineSet; +class SoShapeHints; +class SoMaterialBinding; + +namespace FemGui +{ + + + class FemGuiExport ViewProviderFemMeshShape : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(FemGui::ViewProviderFemMeshShape); + +public: + /// constructor. + ViewProviderFemMeshShape(); + + /// destructor. + ~ViewProviderFemMeshShape(); + + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderFemMeshShape_H diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp new file mode 100644 index 000000000..217869299 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + * 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_ +# include + +#endif + +#include "ViewProviderFemMeshShapeNetgen.h" + + + +using namespace FemGui; + + + + +PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShapeNetgen, Gui::ViewProviderGeometryObject) + + +ViewProviderFemMeshShapeNetgen::ViewProviderFemMeshShapeNetgen() +{ + + +} + +ViewProviderFemMeshShapeNetgen::~ViewProviderFemMeshShapeNetgen() +{ + + +} + diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.h b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.h new file mode 100644 index 000000000..882f033f5 --- /dev/null +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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_ViewProviderFemMeshShapeNetgen_H +#define FEM_ViewProviderFemMeshShapeNetgen_H + +#include +#include + +class SoCoordinate3; +class SoDrawStyle; +class SoIndexedFaceSet; +class SoIndexedLineSet; +class SoShapeHints; +class SoMaterialBinding; + +namespace FemGui +{ + + +class FemGuiExport ViewProviderFemMeshShapeNetgen : public Gui::ViewProviderGeometryObject +{ + PROPERTY_HEADER(FemGui::ViewProviderFemMeshShapeNetgen); + +public: + /// constructor. + ViewProviderFemMeshShapeNetgen(); + + /// destructor. + ~ViewProviderFemMeshShapeNetgen(); + + +}; + +} //namespace FemGui + + +#endif // FEM_ViewProviderFemMeshShapeNetgen_H