1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Triangulation of the skin of the geometry from a Brep representing a plane
23 # Hypothesis and algorithms for the mesh generation are global
31 # ---------------------------- GEOM --------------------------------------
34 #before running this script, please be sure about
35 #the path the file fileName
37 filePath = os.environ["DATA_DIR"]
38 filePath = filePath + "/Shapes/Brep/"
40 filename = "flight_solid.brep"
41 filename = filePath + filename
43 shape = geompy.Import(filename, "BREP")
44 idShape = geompy.addToStudy(shape, "flight")
46 print "Analysis of the geometry flight :"
47 subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"])
48 subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"])
49 subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"])
51 print "number of Shells in flight : ", len(subShellList)
52 print "number of Faces in flight : ", len(subFaceList)
53 print "number of Edges in flight : ", len(subEdgeList)
56 ### ---------------------------- SMESH --------------------------------------
58 # ---- init a Mesh with the shell
59 shape_mesh = salome.IDToObject( idShape )
61 mesh = smesh.Mesh(shape_mesh, "MeshFlight")
64 # ---- set Hypothesis and Algorithm
66 print "-------------------------- LocalLength"
68 lengthOfSegments = 0.3
70 regular1D = mesh.Segment()
71 hypLength = regular1D.LocalLength(lengthOfSegments)
72 print hypLength.GetName()
73 print hypLength.GetId()
74 print hypLength.GetLength()
75 smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments))
77 print "-------------------------- LengthFromEdges"
79 mefisto2D = mesh.Triangle()
80 hypLengthFromEdge = mefisto2D.LengthFromEdges()
81 print hypLengthFromEdge.GetName()
82 print hypLengthFromEdge.GetId()
83 smesh.SetName(hypLengthFromEdge,"LengthFromEdge")
86 salome.sg.updateObjBrowser(1)
89 print "-------------------------- compute the skin flight"
93 log = mesh.GetLog(0) # no erase trace
96 print "Information about the Mesh_mechanic_tetra:"
97 print "Number of nodes : ", mesh.NbNodes()
98 print "Number of edges : ", mesh.NbEdges()
99 print "Number of faces : ", mesh.NbFaces()
100 print "Number of triangles : ", mesh.NbTriangles()
101 print "Number of volumes : ", mesh.NbVolumes()
103 print "probleme when computing the mesh"