1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 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
27 # -----------------------------------------------------------------------------
29 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
31 p0 = geompy.MakeVertex(0., 0., 0.)
32 px = geompy.MakeVertex(100., 0., 0.)
33 py = geompy.MakeVertex(0., 100., 0.)
34 pz = geompy.MakeVertex(0., 0., 100.)
35 vx = geompy.MakeVector(p0, px)
36 vy = geompy.MakeVector(p0, py)
37 vz = geompy.MakeVector(p0, pz)
39 sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
40 sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
41 sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
42 sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
43 ptcyle = geompy.MakeVertex(0., -300., -450.)
44 cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
46 vol1=geompy.MakeCut(sphereExt,sphereA)
47 vol2=geompy.MakeCut(vol1,sphereB)
48 vol3=geompy.MakeCut(vol2,cylindre)
49 blob=geompy.MakeCut(vol3,sphereInt)
51 idblob = geompy.addToStudy(blob,"blob")
53 edgeGroups = geompy.Propagate( blob )
54 assert len( edgeGroups ) == 3
56 salome.sg.updateObjBrowser(1)
58 # -----------------------------------------------------------------------------
60 print "-------------------------- mesh"
61 smesh.SetCurrentStudy(salome.myStudy)
63 # ---- define a mesh on the geom shape 'blob'
64 mesh=smesh.Mesh(blob, "MeshBlob")
66 # ---- assign global hypothesis and algorithms to mesh
67 print "-------------------------- add hypothesis to mesh"
68 algo1 = mesh.Segment()
69 algo2 = mesh.Quadrangle()
70 algo3 = mesh.Hexahedron()
72 # ---- assign local hypothesis and algorithms to mesh
73 for edges in edgeGroups: # loop on groups of logically parallel edges
74 length = geompy.BasicProperties( edges )[0]
75 if length < 500: nbSeg = 4
76 elif length < 2000: nbSeg = 10
78 algo = mesh.Segment( edges )
79 algo.NumberOfSegments( nbSeg )
83 print "-------------------------- compute mesh"
86 print "Information about the Mesh:"
87 print "Number of nodes : ", mesh.NbNodes()
88 print "Number of edges : ", mesh.NbEdges()
89 print "Number of faces : ", mesh.NbFaces()
90 print "Number of quadrangles : ", mesh.NbQuadrangles()
91 print "Number of volumes : ", mesh.NbVolumes()
92 print "Number of hexahedrons : ", mesh.NbHexas()
94 print "problem when Computing the mesh"
96 salome.sg.updateObjBrowser(1)