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
20 print "Analysis of the geometry to be meshed :"
21 subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
22 subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
23 subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
25 print "number of Shells in compshell : ",len(subShellList)
26 print "number of Faces in compshell : ",len(subFaceList)
27 print "number of Edges in compshell : ",len(subEdgeList)
29 status=geompy.CheckShape(compshell)
30 print " check status ", status
32 ### ---------------------------- SMESH --------------------------------------
33 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
35 smeshgui = salome.ImportComponentGUI("SMESH")
36 smeshgui.Init(salome.myStudyId)
38 ### ---- create Hypothesis
40 print "-------------------------- create Hypothesis"
42 print "-------------------------- NumberOfSegments"
46 hypNbSeg=smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
47 hypNbSeg.SetNumberOfSegments(numberOfSegments)
49 print hypNbSeg.GetName()
50 print hypNbSeg.GetId()
51 print hypNbSeg.GetNumberOfSegments()
53 smeshgui.SetName(salome.ObjectToID(hypNbSeg), "NumberOfSegments_5")
55 # ---- create Algorithms
57 print "-------------------------- create Algorithms"
59 print "-------------------------- Regular_1D"
61 regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
63 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
65 print "-------------------------- Quadrangle_2D"
67 quad2D=smesh.CreateHypothesis("Quadrangle_2D", "libStdMeshersEngine.so")
69 smeshgui.SetName(salome.ObjectToID(quad2D), "Quadrangle_2D")
71 print "-------------------------- Hexa_3D"
73 hexa3D=smesh.CreateHypothesis("Hexa_3D", "libStdMeshersEngine.so")
75 smeshgui.SetName(salome.ObjectToID(hexa3D), "Hexa_3D")
77 # ---- init a Mesh with the compshell
78 shape_mesh = salome.IDToObject( idcomp )
80 mesh=smesh.CreateMesh(shape_mesh)
81 smeshgui.SetName(salome.ObjectToID(mesh), "MeshCompShell")
84 # ---- add hypothesis to compshell
86 print "-------------------------- add hypothesis to compshell"
88 mesh.AddHypothesis(shape_mesh,regular1D)
89 mesh.AddHypothesis(shape_mesh,hypNbSeg)
91 mesh.AddHypothesis(shape_mesh,quad2D)
92 mesh.AddHypothesis(shape_mesh,hexa3D)
94 salome.sg.updateObjBrowser(1)
96 print "-------------------------- compute compshell"
97 ret=smesh.Compute(mesh, shape_mesh)
100 log=mesh.GetLog(0) # no erase trace
103 print "Information about the MeshcompShel:"
104 print "Number of nodes : ", mesh.NbNodes()
105 print "Number of edges : ", mesh.NbEdges()
106 print "Number of faces : ", mesh.NbFaces()
107 print "Number of quadrangles : ", mesh.NbQuadrangles()
108 print "Number of volumes : ", mesh.NbVolumes()
109 print "Number of hexahedrons : ", mesh.NbHexas()
111 print "problem when Computing the mesh"