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
12 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
14 smeshgui = salome.ImportComponentGUI("SMESH")
15 smeshgui.Init(salome.myStudyId)
18 # ---------------------------- GEOM --------------------------------------
21 #before running this script, please be sure about
22 #the path the file fileName
24 filePath = os.environ["SMESH_ROOT_DIR"]
25 filePath = filePath + "/share/salome/resources/"
27 filename = "flight_solid.brep"
28 filename = filePath + filename
30 shape = geompy.Import(filename, "BREP")
31 idShape = geompy.addToStudy(shape, "flight")
33 print "Analysis of the geometry flight :"
34 subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
35 subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
36 subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
38 print "number of Shells in flight : ", len(subShellList)
39 print "number of Faces in flight : ", len(subFaceList)
40 print "number of Edges in flight : ", len(subEdgeList)
43 ### ---------------------------- SMESH --------------------------------------
45 print "-------------------------- create Hypothesis"
47 print "-------------------------- LocalLength"
49 lengthOfSegments = 0.3
51 hypLength = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
52 hypLength.SetLength(lengthOfSegments)
54 print hypLength.GetName()
55 print hypLength.GetId()
56 print hypLength.GetLength()
58 smeshgui.SetName(salome.ObjectToID(hypLength), "LocalLength_0.3")
60 print "-------------------------- LengthFromEdges"
62 hypLengthFromEdge = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so")
64 print hypLengthFromEdge.GetName()
65 print hypLengthFromEdge.GetId()
67 smeshgui.SetName(salome.ObjectToID(hypLengthFromEdge), "LengthFromEdge")
69 print "-------------------------- create Algorithms"
71 print "-------------------------- Regular_1D"
73 regular1D = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
75 smeshgui.SetName(salome.ObjectToID(regular1D), "Wire Discretisation")
77 print "-------------------------- MEFISTO_2D"
79 mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
81 smeshgui.SetName(salome.ObjectToID(mefisto2D), "MEFISTO_2D")
83 # ---- init a Mesh with the shell
84 shape_mesh = salome.IDToObject( idShape )
86 mesh = smesh.CreateMesh(shape_mesh)
87 smeshgui.SetName(salome.ObjectToID(mesh), "MeshFlight")
89 # ---- add hypothesis to flight
91 print "-------------------------- add hypothesis to flight"
93 mesh.AddHypothesis(shape_mesh,regular1D)
94 mesh.AddHypothesis(shape_mesh,hypLength)
95 mesh.AddHypothesis(shape_mesh,mefisto2D)
96 mesh.AddHypothesis(shape_mesh,hypLengthFromEdge)
98 salome.sg.updateObjBrowser(1)
101 print "-------------------------- compute the skin flight"
102 ret = smesh.Compute(mesh,shape_mesh)
105 log = mesh.GetLog(0) # no erase trace
108 print "Information about the Mesh_mechanic_tetra:"
109 print "Number of nodes : ", mesh.NbNodes()
110 print "Number of edges : ", mesh.NbEdges()
111 print "Number of faces : ", mesh.NbFaces()
112 print "Number of triangles : ", mesh.NbTriangles()
113 print "Number of volumes : ", mesh.NbVolumes()
115 print "probleme when computing the mesh"