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
15 sg = SMESH_fixation.sg
21 print "Analysis of the geometry to be meshed :"
22 subShellList=geompy.SubShapeAll(compshell,ShapeTypeShell)
23 subFaceList=geompy.SubShapeAll(compshell,ShapeTypeFace)
24 subEdgeList=geompy.SubShapeAll(compshell,ShapeTypeEdge)
26 print "number of Shells in compshell : ",len(subShellList)
27 print "number of Faces in compshell : ",len(subFaceList)
28 print "number of Edges in compshell : ",len(subEdgeList)
30 status=geompy.CheckShape(compshell)
31 print " check status ", status
35 smeshgui = salome.ImportComponentGUI("SMESH")
36 smeshgui.Init(salome.myStudyId)
40 ### ---- create Hypothesis
42 print "-------------------------- create Hypothesis"
44 print "-------------------------- NumberOfSegments"
48 hyp1=gen.CreateHypothesis("NumberOfSegments")
49 hypNbSeg=hyp1._narrow(SMESH.SMESH_NumberOfSegments)
50 hypNbSeg.SetNumberOfSegments(numberOfSegments)
51 hypNbSegID = hypNbSeg.GetId()
52 print hypNbSeg.GetName()
54 print hypNbSeg.GetNumberOfSegments()
56 idseg = smeshgui.AddNewHypothesis( salome.orb.object_to_string(hypNbSeg) )
57 smeshgui.SetName(idseg, "NumberOfSegments")
59 # ---- create Algorithms
61 print "-------------------------- create Algorithms"
63 print "-------------------------- Regular_1D"
65 hypothesis=gen.CreateHypothesis("Regular_1D")
66 regular1D = hypothesis._narrow(SMESH.SMESH_Regular_1D)
67 regularID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(regular1D) )
68 smeshgui.SetName(regularID, "Wire Discretisation")
70 print "-------------------------- Quadrangle_2D"
72 hypothesis=gen.CreateHypothesis("Quadrangle_2D")
73 quad2D = hypothesis._narrow(SMESH.SMESH_Quadrangle_2D)
74 quadID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(quad2D) )
75 smeshgui.SetName(quadID, "Quadrangle_2D")
77 print "-------------------------- Hexa_3D"
79 hypothesis=gen.CreateHypothesis("Hexa_3D")
80 hexa3D = hypothesis._narrow(SMESH.SMESH_Hexa_3D)
81 hexaID = smeshgui.AddNewAlgorithms( salome.orb.object_to_string(hexa3D) )
82 smeshgui.SetName(hexaID, "Hexa_3D")
84 # ---- init a Mesh with the compshell
87 idmesh = smeshgui.AddNewMesh( salome.orb.object_to_string(mesh) )
88 smeshgui.SetName(idmesh, "MeshcompShel")
89 smeshgui.SetShape(idcomp, idmesh)
91 # ---- add hypothesis to compshell
93 print "-------------------------- add hypothesis to compshell"
95 ret=mesh.AddHypothesis(compshell,regular1D)
97 ret=mesh.AddHypothesis(compshell,hypNbSeg)
99 ret=mesh.AddHypothesis(compshell,quad2D)
101 ret=mesh.AddHypothesis(compshell,hexa3D)
104 smeshgui.SetAlgorithms( idmesh, regularID)
105 smeshgui.SetHypothesis( idmesh, idseg )
106 smeshgui.SetAlgorithms( idmesh, quadID )
107 smeshgui.SetAlgorithms( idmesh, hexaID )
109 sg.updateObjBrowser(1)
112 print "-------------------------- compute compshell"
113 ret=gen.Compute(mesh,idcomp)
116 log=mesh.GetLog(0) # no erase trace
120 print "problem when Computing the mesh"
122 sg.updateObjBrowser(1)