2 # Triangulation of the skin of the geometry from a Brep representing a plane
3 # This geometry is from EADS
4 # Hypothesis and algorithms for the mesh generation are global
13 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
14 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
16 smeshgui = salome.ImportComponentGUI("SMESH")
17 smeshgui.Init(salome.myStudyId);
20 # ---------------------------- GEOM --------------------------------------
27 #before running this script, please be sure about
28 #the path the file fileName
30 filePath=os.environ["SMESH_ROOT_DIR"]
31 filePath=filePath+"/share/salome/resources/"
33 filename = "flight_solid.brep"
34 filename = filePath + filename
36 shape = geompy.ImportBREP(filename)
37 idShape = geompy.addToStudy(shape,"flight")
39 print "Analysis of the geometry flight :"
40 subShellList=geompy.SubShapeAll(shape,ShapeTypeShell)
41 subFaceList=geompy.SubShapeAll(shape,ShapeTypeFace)
42 subEdgeList=geompy.SubShapeAll(shape,ShapeTypeEdge)
44 print "number of Shells in flight : ",len(subShellList)
45 print "number of Faces in flight : ",len(subFaceList)
46 print "number of Edges in flight : ",len(subEdgeList)
49 ### ---------------------------- SMESH --------------------------------------
51 # ---- create Hypothesis
53 print "-------------------------- create Hypothesis"
55 print "-------------------------- LocalLength"
57 lengthOfSegments = 0.3
59 hypLength=smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
60 hypLength.SetLength(lengthOfSegments)
62 print hypLength.GetName()
63 print hypLength.GetId()
64 print hypLength.GetLength()
66 smeshgui.SetName(salome.ObjectToID(hypLength), "LocalLength_0.3")
68 print "-------------------------- LengthFromEdges"
70 hypLengthFromEdge=smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
72 print hypLengthFromEdge.GetName()
73 print hypLengthFromEdge.GetId()
75 smeshgui.SetName(salome.ObjectToID(hypLengthFromEdge), "LengthFromEdge")
77 # ---- create Algorithms
79 print "-------------------------- create Algorithms"
81 print "-------------------------- Regular_1D"
83 regular1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
85 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
87 print "-------------------------- MEFISTO_2D"
89 mefisto2D=smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
91 smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
93 # ---- init a Mesh with the shell
94 shape_mesh = salome.IDToObject( idShape )
96 mesh=smesh.CreateMesh(shape_mesh)
97 smeshgui.SetName(salome.ObjectToID(mesh), "MeshFlight")
99 # ---- add hypothesis to flight
101 print "-------------------------- add hypothesis to flight"
103 mesh.AddHypothesis(shape_mesh,regular1D)
104 mesh.AddHypothesis(shape_mesh,hypLength)
105 mesh.AddHypothesis(shape_mesh,mefisto2D)
106 mesh.AddHypothesis(shape_mesh,hypLengthFromEdge)
108 salome.sg.updateObjBrowser(1)
111 print "-------------------------- compute the skin flight"
112 ret=smesh.Compute(mesh,shape_mesh)
115 log=mesh.GetLog(0) # no erase trace
118 print "Information about the Mesh_mechanic_tetra:"
119 print "Number of nodes : ", mesh.NbNodes()
120 print "Number of edges : ", mesh.NbEdges()
121 print "Number of faces : ", mesh.NbFaces()
122 print "Number of triangles : ", mesh.NbTriangles()
123 print "Number of volumes : ", mesh.NbVolumes()
125 print "probleme when computing the mesh"