2 # Hexahedrization 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 "-------------------------- create Algorithms"
51 print "-------------------------- Regular_1D"
53 regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
55 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
57 print "-------------------------- Quadrangle_2D"
59 quad2D = smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
61 smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D")
63 print "-------------------------- Hexa_3D"
65 hexa3D = smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
67 smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D")
69 # ---- init a Mesh with the compshell
70 shape_mesh = salome.IDToObject( idcomp )
72 mesh = smesh.CreateMesh(shape_mesh)
73 smeshgui.SetName(salome.ObjectToID(mesh), "MeshCompShell")
76 print "-------------------------- add hypothesis to compshell"
78 mesh.AddHypothesis(shape_mesh,regular1D)
79 mesh.AddHypothesis(shape_mesh,hypNbSeg)
81 mesh.AddHypothesis(shape_mesh,quad2D)
82 mesh.AddHypothesis(shape_mesh,hexa3D)
84 salome.sg.updateObjBrowser(1)
86 print "-------------------------- compute compshell"
87 ret = smesh.Compute(mesh, shape_mesh)
90 log = mesh.GetLog(0) # no erase trace
93 print "Information about the MeshcompShel:"
94 print "Number of nodes : ", mesh.NbNodes()
95 print "Number of edges : ", mesh.NbEdges()
96 print "Number of faces : ", mesh.NbFaces()
97 print "Number of quadrangles : ", mesh.NbQuadrangles()
98 print "Number of volumes : ", mesh.NbVolumes()
99 print "Number of hexahedrons : ", mesh.NbHexas()
101 print "problem when Computing the mesh"