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 #==============================================================================
24 # Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153
25 # Modified : 25/11/2004
26 # Author : Kovaltchuk Alexey
27 # Project : PAL/SALOME
28 #==============================================================================
36 # -----------------------------------------------------------------------------
38 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
39 myBuilder = salome.myStudy.NewBuilder()
40 gg = salome.ImportComponentGUI("GEOM")
42 ShapeTypeCompSolid = 1
55 p0 = geompy.MakeVertex(0., 0., 0.)
56 px = geompy.MakeVertex(100., 0., 0.)
57 py = geompy.MakeVertex(0., 100., 0.)
58 pz = geompy.MakeVertex(0., 0., 100.)
59 vx = geompy.MakeVector(p0, px)
60 vy = geompy.MakeVector(p0, py)
61 vz = geompy.MakeVector(p0, pz)
63 sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
64 sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
65 sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
66 sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
67 ptcyle = geompy.MakeVertex(0., -300., -450.)
68 cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
70 vol1=geompy.MakeCut(sphereExt,sphereA)
71 vol2=geompy.MakeCut(vol1,sphereB)
72 vol3=geompy.MakeCut(vol2,cylindre)
73 blob=geompy.MakeCut(vol3,sphereInt)
75 idblob = geompy.addToStudy(blob,"blob")
78 aretes = geompy.SubShapeAllSorted(blob, ShapeTypeEdge)
81 # -------------------------------
82 # --- numerotation des aretes
84 ## edname="arete%d"%eid
85 ## idedge=geompy.addToStudy(edge,edname)
88 salome.sg.updateObjBrowser(1)
90 # --- epaisseur 0 2 8 10
91 # --- hauteur 1 3 9 11
94 # -----------------------------------------------------------------------------
96 print "-------------------------- mesh"
98 # ---- init a Mesh with the geom shape
100 mesh=smesh.Mesh(shape_mesh, "MeshBlob")
102 # ---- add hypothesis and algorithms to mesh
103 print "-------------------------- add hypothesis to mesh"
104 algo1 = mesh.Segment()
105 algo2 = mesh.Quadrangle()
106 algo3 = mesh.Hexahedron()
108 numberOfSegmentsA = 4
110 algo = mesh.Segment(aretes[0])
111 algo.NumberOfSegments(numberOfSegmentsA)
112 algo = mesh.Segment(aretes[2])
113 algo.NumberOfSegments(numberOfSegmentsA)
114 algo = mesh.Segment(aretes[8])
115 algo.NumberOfSegments(numberOfSegmentsA)
116 algo = mesh.Segment(aretes[10])
117 algo.NumberOfSegments(numberOfSegmentsA)
120 numberOfSegmentsC = 15
122 algo = mesh.Segment(aretes[1])
123 algo.NumberOfSegments(numberOfSegmentsC)
124 algo = mesh.Segment(aretes[3])
125 algo.NumberOfSegments(numberOfSegmentsC)
126 algo = mesh.Segment(aretes[9])
127 algo.NumberOfSegments(numberOfSegmentsC)
128 algo = mesh.Segment(aretes[11])
129 algo.NumberOfSegments(numberOfSegmentsC)
132 numberOfSegmentsB = 10
133 algo = mesh.Segment(aretes[4])
134 algo.NumberOfSegments(numberOfSegmentsB)
135 algo = mesh.Segment(aretes[5])
136 algo.NumberOfSegments(numberOfSegmentsB)
137 algo = mesh.Segment(aretes[6])
138 algo.NumberOfSegments(numberOfSegmentsB)
139 algo = mesh.Segment(aretes[7])
140 algo.NumberOfSegments(numberOfSegmentsB)
145 print "-------------------------- compute mesh"
149 #log=mesh.GetLog(0) # no erase trace
152 print "Information about the Mesh:"
153 print "Number of nodes : ", mesh.NbNodes()
154 print "Number of edges : ", mesh.NbEdges()
155 print "Number of faces : ", mesh.NbFaces()
156 print "Number of quadrangles : ", mesh.NbQuadrangles()
157 print "Number of volumes : ", mesh.NbVolumes()
158 print "Number of hexahedrons : ", mesh.NbHexas()
160 print "problem when Computing the mesh"
162 salome.sg.updateObjBrowser(1)