2 # Tetrahedrization of the geometry generated by the Python script
4 # Hypothesis and algorithms for the mesh generation are global
11 compshell = SMESH_fixation.compshell
12 idcomp = SMESH_fixation.idcomp
13 geompy = SMESH_fixation.geompy
14 salome = SMESH_fixation.salome
16 print "Analysis of the geometry to be meshed :"
17 subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"])
18 subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"])
19 subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"])
21 print "number of Shells in compshell : ", len(subShellList)
22 print "number of Faces in compshell : ", len(subFaceList)
23 print "number of Edges in compshell : ", len(subEdgeList)
25 status = geompy.CheckShape(compshell)
26 print " check status ", status
28 ### ---------------------------- SMESH --------------------------------------
29 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
31 smeshgui = salome.ImportComponentGUI("SMESH")
32 smeshgui.Init(salome.myStudyId)
34 print "-------------------------- create Hypothesis"
36 print "-------------------------- NumberOfSegments"
40 hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
41 hypNbSeg.SetNumberOfSegments(numberOfSegments)
43 print hypNbSeg.GetName()
44 print hypNbSeg.GetId()
45 print hypNbSeg.GetNumberOfSegments()
47 smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5")
49 print "-------------------------- MaxElementArea"
51 ## maxElementArea = 80
53 ## hypArea=smesh.CreateHypothesis("MaxElementArea")
54 ## hypArea.SetMaxElementArea(maxElementArea)
55 ## print hypArea.GetName()
56 ## print hypArea.GetId()
57 ## print hypArea.GetMaxElementArea()
58 ## smeshgui.SetName(salome.ObjectToID(hypArea), "MaxElementArea_160")
60 hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
61 smeshgui.SetName(salome.ObjectToID(hypLengthFromEdges), "LengthFromEdges")
64 print "-------------------------- MaxElementVolume"
66 maxElementVolume = 1000
68 hypVolume = smesh.CreateHypothesis("MaxElementVolume", "libStdMeshersEngine.so")
69 hypVolume.SetMaxElementVolume(maxElementVolume)
71 print hypVolume.GetName()
72 print hypVolume.GetId()
73 print hypVolume.GetMaxElementVolume()
75 smeshgui.SetName(salome.ObjectToID(hypVolume), "MaxElementVolume_1000")
77 print "-------------------------- create Algorithms"
79 print "-------------------------- Regular_1D"
81 regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
83 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
85 print "-------------------------- MEFISTO_2D"
87 mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
89 smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
91 print "-------------------------- NETGEN_3D"
93 netgen3D = smesh.CreateHypothesis("NETGEN_3D", "libNETGENEngine.so")
95 smeshgui.SetName(salome.ObjectToID(netgen3D), "NETGEN_3D")
97 # ---- init a Mesh with the compshell
99 mesh = smesh.CreateMesh(compshell)
100 smeshgui.SetName(salome.ObjectToID(mesh), "MeshcompShel")
102 print "-------------------------- add hypothesis to compshell"
104 mesh.AddHypothesis(compshell,regular1D)
105 mesh.AddHypothesis(compshell,hypNbSeg)
107 mesh.AddHypothesis(compshell,mefisto2D)
108 mesh.AddHypothesis(compshell,hypLengthFromEdges)
110 mesh.AddHypothesis(compshell,netgen3D)
111 mesh.AddHypothesis(compshell,hypVolume)
113 salome.sg.updateObjBrowser(1)
115 print "-------------------------- compute compshell"
116 ret = smesh.Compute(mesh,compshell)
119 log = mesh.GetLog(0) # no erase trace
122 print "Information about the MeshcompShel:"
123 print "Number of nodes : ", mesh.NbNodes()
124 print "Number of edges : ", mesh.NbEdges()
125 print "Number of faces : ", mesh.NbFaces()
126 print "Number of triangles : ", mesh.NbTriangles()
127 print "Number of volumes : ", mesh.NbVolumes()
128 print "Number of tetrahedrons : ", mesh.NbTetras()
131 print "problem when computing the mesh"