Adding additional objects to FEM
This commit is contained in:
parent
eaa639e5ae
commit
2bc64acebf
|
@ -33,8 +33,10 @@
|
|||
#include "FemMeshPy.h"
|
||||
#include "FemMesh.h"
|
||||
#include "FemMeshProperty.h"
|
||||
#include "FemAnalysis.h"
|
||||
#include "FemMeshObject.h"
|
||||
#include "FemMeshShapeObject.h"
|
||||
#include "FemMeshShapeNetgenObject.h"
|
||||
|
||||
#include "FemSetElementsObject.h"
|
||||
#include "FemSetFacesObject.h"
|
||||
|
@ -111,23 +113,25 @@ void AppFemExport initFem()
|
|||
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
|
||||
// This function is responsible for adding inherited slots from a type's base class.
|
||||
|
||||
Fem::FemMesh ::init();
|
||||
Fem::FemMeshObject ::init();
|
||||
Fem::FemMeshShapeObject ::init();
|
||||
Fem::PropertyFemMesh ::init();
|
||||
Fem::FemAnalysis ::init();
|
||||
Fem::FemMesh ::init();
|
||||
Fem::FemMeshObject ::init();
|
||||
Fem::FemMeshShapeObject ::init();
|
||||
Fem::FemMeshShapeNetgenObject ::init();
|
||||
Fem::PropertyFemMesh ::init();
|
||||
|
||||
Fem::FemSetObject ::init();
|
||||
Fem::FemSetElementsObject ::init();
|
||||
Fem::FemSetFacesObject ::init();
|
||||
Fem::FemSetGeometryObject ::init();
|
||||
Fem::FemSetNodesObject ::init();
|
||||
Fem::FemSetObject ::init();
|
||||
Fem::FemSetElementsObject ::init();
|
||||
Fem::FemSetFacesObject ::init();
|
||||
Fem::FemSetGeometryObject ::init();
|
||||
Fem::FemSetNodesObject ::init();
|
||||
|
||||
Fem::Constraint ::init();
|
||||
Fem::ConstraintBearing ::init();
|
||||
Fem::ConstraintFixed ::init();
|
||||
Fem::ConstraintForce ::init();
|
||||
Fem::ConstraintGear ::init();
|
||||
Fem::ConstraintPulley ::init();
|
||||
Fem::Constraint ::init();
|
||||
Fem::ConstraintBearing ::init();
|
||||
Fem::ConstraintFixed ::init();
|
||||
Fem::ConstraintForce ::init();
|
||||
Fem::ConstraintGear ::init();
|
||||
Fem::ConstraintPulley ::init();
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemAnalysis";
|
||||
return "FemGui::ViewProviderAnalysis";
|
||||
}
|
||||
virtual App::DocumentObjectExecReturn *execute(void) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
|
|
|
@ -64,6 +64,8 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
|
|||
|
||||
Part::Feature *feat = Shape.getValue<Part::Feature*>();
|
||||
TopoDS_Shape shape = feat->Shape.getValue();
|
||||
if(shape.IsNull())
|
||||
return App::DocumentObject::StdReturn;
|
||||
|
||||
NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true);
|
||||
|
||||
|
|
|
@ -31,6 +31,49 @@
|
|||
#include <App/DocumentObjectPy.h>
|
||||
#include <Base/Placement.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <SMESH_Gen.hxx>
|
||||
#include <SMESH_Mesh.hxx>
|
||||
#include <SMDS_PolyhedralVolumeOfNodes.hxx>
|
||||
#include <SMDS_VolumeTool.hxx>
|
||||
#include <StdMeshers_Arithmetic1D.hxx>
|
||||
#include <StdMeshers_AutomaticLength.hxx>
|
||||
#include <StdMeshers_MaxLength.hxx>
|
||||
#include <StdMeshers_LocalLength.hxx>
|
||||
#include <StdMeshers_MaxElementArea.hxx>
|
||||
#include <StdMeshers_NotConformAllowed.hxx>
|
||||
#include <StdMeshers_QuadranglePreference.hxx>
|
||||
#include <StdMeshers_Quadrangle_2D.hxx>
|
||||
#include <StdMeshers_Regular_1D.hxx>
|
||||
#include <StdMeshers_UseExisting_1D2D.hxx>
|
||||
#include <StdMeshers_CompositeSegment_1D.hxx>
|
||||
#include <StdMeshers_Deflection1D.hxx>
|
||||
#include <StdMeshers_Hexa_3D.hxx>
|
||||
#include <StdMeshers_LayerDistribution.hxx>
|
||||
#include <StdMeshers_LengthFromEdges.hxx>
|
||||
#include <StdMeshers_MaxElementVolume.hxx>
|
||||
#include <StdMeshers_MEFISTO_2D.hxx>
|
||||
#include <StdMeshers_NumberOfLayers.hxx>
|
||||
#include <StdMeshers_NumberOfSegments.hxx>
|
||||
#include <StdMeshers_Prism_3D.hxx>
|
||||
#include <StdMeshers_Projection_1D.hxx>
|
||||
#include <StdMeshers_Projection_2D.hxx>
|
||||
#include <StdMeshers_Projection_3D.hxx>
|
||||
#include <StdMeshers_QuadraticMesh.hxx>
|
||||
#include <StdMeshers_RadialPrism_3D.hxx>
|
||||
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
|
||||
#include <StdMeshers_TrianglePreference.hxx>
|
||||
#include <StdMeshers_ProjectionSource1D.hxx>
|
||||
#include <StdMeshers_ProjectionSource2D.hxx>
|
||||
#include <StdMeshers_ProjectionSource3D.hxx>
|
||||
#include <StdMeshers_SegmentLengthAroundVertex.hxx>
|
||||
#include <StdMeshers_StartEndLength.hxx>
|
||||
//#include <StdMeshers_Propagation.hxx>
|
||||
#include <StdMeshers_CompositeHexa_3D.hxx>
|
||||
#include <NETGENPlugin_SimpleHypothesis_3D.hxx>
|
||||
#include <NETGENPlugin_Mesher.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
using namespace Fem;
|
||||
using namespace App;
|
||||
|
@ -47,140 +90,140 @@ FemMeshShapeObject::~FemMeshShapeObject()
|
|||
{
|
||||
}
|
||||
|
||||
//App::DocumentObjectExecReturn *FemMeshShapeObject::execute(void)
|
||||
//{
|
||||
// Fem::FemMesh newMesh;
|
||||
//
|
||||
// Part::Feature *feat = Shape.getValue<Part::Feature*>();
|
||||
//
|
||||
//#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<StdMeshers_MaxLength*>(len.get())->SetLength(1.0);
|
||||
// newMesh.addHypothesis(shape, len);
|
||||
//
|
||||
// SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_LocalLength*>(loc.get())->SetLength(1.0);
|
||||
// newMesh.addHypothesis(shape, loc);
|
||||
//
|
||||
// SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_MaxElementArea*>(area.get())->SetMaxArea(1.0);
|
||||
// newMesh.addHypothesis(shape, area);
|
||||
//
|
||||
// SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_NumberOfSegments*>(segm.get())->SetNumberOfSegments(1);
|
||||
// newMesh.addHypothesis(shape, segm);
|
||||
//
|
||||
// SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_Deflection1D*>(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<StdMeshers_StartEndLength*>(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<StdMeshers_MaxLength*>(len.get())->SetLength(1.0);
|
||||
// newMesh.addHypothesis(shape, len);
|
||||
//
|
||||
// SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_LocalLength*>(loc.get())->SetLength(1.0);
|
||||
// newMesh.addHypothesis(shape, loc);
|
||||
//
|
||||
// SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_MaxElementArea*>(area.get())->SetMaxArea(1.0);
|
||||
// newMesh.addHypothesis(shape, area);
|
||||
//
|
||||
// SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_NumberOfSegments*>(segm.get())->SetNumberOfSegments(1);
|
||||
// newMesh.addHypothesis(shape, segm);
|
||||
//
|
||||
// SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen));
|
||||
// static_cast<StdMeshers_Deflection1D*>(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<StdMeshers_StartEndLength*>(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<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->SetNumberOfSegments(5);
|
||||
// //static_cast<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->SetLocalLength(0.1);
|
||||
// //static_cast<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->LengthFromEdges();
|
||||
// //myNetGenMesher.SetParameters(tet2);
|
||||
//
|
||||
// //NETGENPlugin_SimpleHypothesis_3D* tet= new NETGENPlugin_SimpleHypothesis_3D(hyp++,1,myGen);
|
||||
// //static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->LengthFromFaces();
|
||||
// //static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->SetMaxElementVolume(0.1);
|
||||
// //myNetGenMesher.SetParameters( tet);
|
||||
//
|
||||
// myNetGenMesher.Compute();
|
||||
//#endif
|
||||
//
|
||||
//
|
||||
//
|
||||
// SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(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<Part::Feature*>();
|
||||
|
||||
#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<StdMeshers_MaxLength*>(len.get())->SetLength(1.0);
|
||||
newMesh.addHypothesis(shape, len);
|
||||
|
||||
SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_LocalLength*>(loc.get())->SetLength(1.0);
|
||||
newMesh.addHypothesis(shape, loc);
|
||||
|
||||
SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_MaxElementArea*>(area.get())->SetMaxArea(1.0);
|
||||
newMesh.addHypothesis(shape, area);
|
||||
|
||||
SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_NumberOfSegments*>(segm.get())->SetNumberOfSegments(1);
|
||||
newMesh.addHypothesis(shape, segm);
|
||||
|
||||
SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_Deflection1D*>(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<StdMeshers_StartEndLength*>(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<StdMeshers_MaxLength*>(len.get())->SetLength(1.0);
|
||||
newMesh.addHypothesis(shape, len);
|
||||
|
||||
SMESH_HypothesisPtr loc(new StdMeshers_LocalLength(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_LocalLength*>(loc.get())->SetLength(1.0);
|
||||
newMesh.addHypothesis(shape, loc);
|
||||
|
||||
SMESH_HypothesisPtr area(new StdMeshers_MaxElementArea(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_MaxElementArea*>(area.get())->SetMaxArea(1.0);
|
||||
newMesh.addHypothesis(shape, area);
|
||||
|
||||
SMESH_HypothesisPtr segm(new StdMeshers_NumberOfSegments(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_NumberOfSegments*>(segm.get())->SetNumberOfSegments(1);
|
||||
newMesh.addHypothesis(shape, segm);
|
||||
|
||||
SMESH_HypothesisPtr defl(new StdMeshers_Deflection1D(hyp++, 1, myGen));
|
||||
static_cast<StdMeshers_Deflection1D*>(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<StdMeshers_StartEndLength*>(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<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->SetNumberOfSegments(5);
|
||||
//static_cast<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->SetLocalLength(0.1);
|
||||
//static_cast<NETGENPlugin_SimpleHypothesis_2D*>(tet2.get())->LengthFromEdges();
|
||||
//myNetGenMesher.SetParameters(tet2);
|
||||
|
||||
//NETGENPlugin_SimpleHypothesis_3D* tet= new NETGENPlugin_SimpleHypothesis_3D(hyp++,1,myGen);
|
||||
//static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->LengthFromFaces();
|
||||
//static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->SetMaxElementVolume(0.1);
|
||||
//myNetGenMesher.SetParameters( tet);
|
||||
|
||||
myNetGenMesher.Compute();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(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
|
||||
//{
|
||||
|
|
|
@ -40,10 +40,10 @@ public:
|
|||
virtual ~FemMeshShapeObject();
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
//virtual const char* getViewProviderName(void) const {
|
||||
// return "FemGui::ViewProviderFemMeshShape";
|
||||
//}
|
||||
//virtual App::DocumentObjectExecReturn *execute(void);
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemMeshShape";
|
||||
}
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
//virtual short mustExecute(void) const;
|
||||
//virtual PyObject *getPyObject(void);
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include <Gui/Application.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include "ViewProviderFemMesh.h"
|
||||
#include "ViewProviderFemMeshShape.h"
|
||||
#include "ViewProviderFemMeshShapeNetgen.h"
|
||||
#include "ViewProviderAnalysis.h"
|
||||
#include "ViewProviderSetNodes.h"
|
||||
#include "ViewProviderSetElements.h"
|
||||
#include "ViewProviderSetFaces.h"
|
||||
|
@ -73,18 +76,21 @@ void FemGuiExport initFemGui()
|
|||
CreateFemCommands();
|
||||
|
||||
// addition objects
|
||||
FemGui::Workbench ::init();
|
||||
FemGui::ViewProviderFemMesh ::init();
|
||||
FemGui::ViewProviderSetNodes ::init();
|
||||
FemGui::ViewProviderSetElements ::init();
|
||||
FemGui::ViewProviderSetFaces ::init();
|
||||
FemGui::ViewProviderSetGeometry ::init();
|
||||
FemGui::ViewProviderFemConstraint ::init();
|
||||
FemGui::ViewProviderFemConstraintBearing ::init();
|
||||
FemGui::ViewProviderFemConstraintFixed ::init();
|
||||
FemGui::ViewProviderFemConstraintForce ::init();
|
||||
FemGui::ViewProviderFemConstraintGear ::init();
|
||||
FemGui::ViewProviderFemConstraintPulley ::init();
|
||||
FemGui::Workbench ::init();
|
||||
FemGui::ViewProviderAnalysis ::init();
|
||||
FemGui::ViewProviderFemMesh ::init();
|
||||
FemGui::ViewProviderFemMeshShape ::init();
|
||||
FemGui::ViewProviderFemMeshShapeNetgen ::init();
|
||||
FemGui::ViewProviderSetNodes ::init();
|
||||
FemGui::ViewProviderSetElements ::init();
|
||||
FemGui::ViewProviderSetFaces ::init();
|
||||
FemGui::ViewProviderSetGeometry ::init();
|
||||
FemGui::ViewProviderFemConstraint ::init();
|
||||
FemGui::ViewProviderFemConstraintBearing ::init();
|
||||
FemGui::ViewProviderFemConstraintFixed ::init();
|
||||
FemGui::ViewProviderFemConstraintForce ::init();
|
||||
FemGui::ViewProviderFemConstraintGear ::init();
|
||||
FemGui::ViewProviderFemConstraintPulley ::init();
|
||||
|
||||
// add resources and reloads the translators
|
||||
loadFemResource();
|
||||
|
|
|
@ -120,10 +120,16 @@ void CmdFemCreateAnalysis::activated(int iMsg)
|
|||
|
||||
Part::Feature *base = static_cast<Part::Feature*>(selection[0].getObject());
|
||||
|
||||
std::string AnalysisName = getUniqueObjectName("FemAnalysis");
|
||||
|
||||
std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str());
|
||||
|
||||
|
||||
openCommand("Create FEM analysis");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeObject','%s')","FemShape");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument());
|
||||
doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str());
|
||||
updateActive();
|
||||
|
||||
}
|
||||
|
|
|
@ -29,10 +29,13 @@
|
|||
#endif
|
||||
|
||||
#include "ViewProviderAnalysis.h"
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#include <Mod/Fem/App/FemMeshObject.h>
|
||||
#include <Mod/Fem/App/FemMesh.h>
|
||||
#include <Mod/Fem/App/FemAnalysis.h>
|
||||
|
||||
#include "TaskDlgAnalysis.h"
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
|
@ -42,7 +45,7 @@ using namespace FemGui;
|
|||
|
||||
|
||||
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderGeometryObject)
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderAnalysis, Gui::ViewProviderDocumentObject)
|
||||
|
||||
|
||||
ViewProviderAnalysis::ViewProviderAnalysis()
|
||||
|
@ -56,3 +59,95 @@ ViewProviderAnalysis::~ViewProviderAnalysis()
|
|||
|
||||
}
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren(void)const
|
||||
{
|
||||
std::vector<App::DocumentObject*> temp(static_cast<Fem::FemAnalysis*>(getObject())->Member.getValues());
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
//std::vector<App::DocumentObject*> ViewProviderAnalysis::claimChildren3D(void)const
|
||||
//{
|
||||
//
|
||||
// //return static_cast<Assembly::ConstraintGroup*>(getObject())->Constraints.getValues();
|
||||
// return std::vector<App::DocumentObject*> ();
|
||||
//}
|
||||
|
||||
void ViewProviderAnalysis::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
//QAction* act;
|
||||
//act = menu->addAction(QObject::tr("Edit pad"), receiver, member);
|
||||
//act->setData(QVariant((int)ViewProvider::Default));
|
||||
//PartGui::ViewProviderPart::setupContextMenu(menu, receiver, member);
|
||||
}
|
||||
|
||||
bool ViewProviderAnalysis::setEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
//// When double-clicking on the item for this pad the
|
||||
//// object unsets and sets its edit mode without closing
|
||||
//// the task panel
|
||||
//Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
//TaskDlgAnalysis *anaDlg = qobject_cast<TaskDlgAnalysis *>(dlg);
|
||||
//if (padDlg && anaDlg->getPadView() != this)
|
||||
// padDlg = 0; // another pad left open its task panel
|
||||
//if (dlg && !padDlg) {
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
|
||||
// msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?"));
|
||||
// msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
// msgBox.setDefaultButton(QMessageBox::Yes);
|
||||
// int ret = msgBox.exec();
|
||||
// if (ret == QMessageBox::Yes)
|
||||
// Gui::Control().closeDialog();
|
||||
// else
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// start the edit dialog
|
||||
// if (padDlg)
|
||||
// Gui::Control().showDialog(padDlg);
|
||||
// else
|
||||
|
||||
Fem::FemAnalysis* pcAna = static_cast<Fem::FemAnalysis*>(this->getObject());
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgAnalysis(pcAna));
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Gui::ViewProviderDocumentObject::setEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderAnalysis::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
else {
|
||||
Gui::ViewProviderDocumentObject::unsetEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderAnalysis::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
//// get the support and Sketch
|
||||
//PartDesign::Pad* pcPad = static_cast<PartDesign::Pad*>(getObject());
|
||||
//Sketcher::SketchObject *pcSketch = 0;
|
||||
//App::DocumentObject *pcSupport = 0;
|
||||
//if (pcPad->Sketch.getValue()){
|
||||
// pcSketch = static_cast<Sketcher::SketchObject*>(pcPad->Sketch.getValue());
|
||||
// pcSupport = pcSketch->Support.getValue();
|
||||
//}
|
||||
|
||||
//// if abort command deleted the object the support is visible again
|
||||
//if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
|
||||
// Gui::Application::Instance->getViewProvider(pcSketch)->show();
|
||||
//if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport))
|
||||
// Gui::Application::Instance->getViewProvider(pcSupport)->show();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -39,7 +39,7 @@ namespace FemGui
|
|||
|
||||
|
||||
|
||||
class FemGuiExport ViewProviderAnalysis : public Gui::ViewProviderGeometryObject
|
||||
class FemGuiExport ViewProviderAnalysis : public Gui::ViewProviderDocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(FemGui::ViewProviderAnalysis);
|
||||
|
||||
|
@ -50,6 +50,17 @@ public:
|
|||
/// destructor.
|
||||
~ViewProviderAnalysis();
|
||||
|
||||
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
|
||||
|
||||
//virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
|
||||
void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
|
||||
virtual bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
protected:
|
||||
virtual bool setEdit(int ModNum);
|
||||
virtual void unsetEdit(int ModNum);
|
||||
|
||||
};
|
||||
|
||||
} //namespace FemGui
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace FemGui;
|
|||
|
||||
|
||||
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShape, Gui::ViewProviderGeometryObject)
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShape, FemGui::ViewProviderFemMesh)
|
||||
|
||||
|
||||
ViewProviderFemMeshShape::ViewProviderFemMeshShape()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef FEM_ViewProviderFemMeshShape_H
|
||||
#define FEM_ViewProviderFemMeshShape_H
|
||||
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
#include "ViewProviderFemMesh.h"
|
||||
#include <Gui/ViewProviderBuilder.h>
|
||||
|
||||
class SoCoordinate3;
|
||||
|
@ -38,7 +38,7 @@ namespace FemGui
|
|||
{
|
||||
|
||||
|
||||
class FemGuiExport ViewProviderFemMeshShape : public Gui::ViewProviderGeometryObject
|
||||
class FemGuiExport ViewProviderFemMeshShape : public ViewProviderFemMesh
|
||||
{
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemMeshShape);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace FemGui;
|
|||
|
||||
|
||||
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShapeNetgen, Gui::ViewProviderGeometryObject)
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemMeshShapeNetgen, FemGui::ViewProviderFemMeshShape)
|
||||
|
||||
|
||||
ViewProviderFemMeshShapeNetgen::ViewProviderFemMeshShapeNetgen()
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef FEM_ViewProviderFemMeshShapeNetgen_H
|
||||
#define FEM_ViewProviderFemMeshShapeNetgen_H
|
||||
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
#include "ViewProviderFemMeshShape.h"
|
||||
#include <Gui/ViewProviderBuilder.h>
|
||||
|
||||
class SoCoordinate3;
|
||||
|
@ -38,7 +38,7 @@ namespace FemGui
|
|||
{
|
||||
|
||||
|
||||
class FemGuiExport ViewProviderFemMeshShapeNetgen : public Gui::ViewProviderGeometryObject
|
||||
class FemGuiExport ViewProviderFemMeshShapeNetgen : public ViewProviderFemMeshShape
|
||||
{
|
||||
PROPERTY_HEADER(FemGui::ViewProviderFemMeshShapeNetgen);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user