Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 import os
00028 import salome
00029 import geompy
00030 import smesh
00031
00032
00033
00034
00035
00036
00037
00038
00039 filePath = os.environ["DATA_DIR"]
00040 filePath = filePath + "/Shapes/Brep/"
00041
00042 filename = "flight_solid.brep"
00043 filename = filePath + filename
00044
00045 shape = geompy.Import(filename, "BREP")
00046 idShape = geompy.addToStudy(shape, "flight")
00047
00048 print "Analysis of the geometry flight :"
00049 subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
00050 subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
00051 subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
00052
00053 print "number of Shells in flight : ", len(subShellList)
00054 print "number of Faces in flight : ", len(subFaceList)
00055 print "number of Edges in flight : ", len(subEdgeList)
00056
00057
00058
00059 smesh.SetCurrentStudy(salome.myStudy)
00060
00061
00062 shape_mesh = salome.IDToObject( idShape )
00063
00064 mesh = smesh.Mesh(shape_mesh, "MeshFlight")
00065
00066
00067
00068
00069 print "-------------------------- LocalLength"
00070
00071 lengthOfSegments = 0.3
00072
00073 regular1D = mesh.Segment()
00074 hypLength = regular1D.LocalLength(lengthOfSegments)
00075 print hypLength.GetName()
00076 print hypLength.GetId()
00077 print hypLength.GetLength()
00078 smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments))
00079
00080 print "-------------------------- LengthFromEdges"
00081
00082 mefisto2D = mesh.Triangle()
00083 hypLengthFromEdge = mefisto2D.LengthFromEdges()
00084 print hypLengthFromEdge.GetName()
00085 print hypLengthFromEdge.GetId()
00086 smesh.SetName(hypLengthFromEdge,"LengthFromEdge")
00087
00088
00089 salome.sg.updateObjBrowser(1)
00090
00091
00092 print "-------------------------- compute the skin flight"
00093 ret = mesh.Compute()
00094 print ret
00095 if ret != 0:
00096 log = mesh.GetLog(0)
00097 for linelog in log:
00098 print linelog
00099 print "Information about the Mesh_mechanic_tetra:"
00100 print "Number of nodes : ", mesh.NbNodes()
00101 print "Number of edges : ", mesh.NbEdges()
00102 print "Number of faces : ", mesh.NbFaces()
00103 print "Number of triangles : ", mesh.NbTriangles()
00104 print "Number of volumes : ", mesh.NbVolumes()
00105 else:
00106 print "probleme when computing the mesh"