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