2 # -*- coding: iso-8859-1 -*-
3 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
5 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #==============================================================================
26 # Bug (from script, bug) : hexaedre_modified.py, PAL6194, PAL7153
27 # Modified : 25/11/2004
28 # Author : Kovaltchuk Alexey
29 # Project : PAL/SALOME
30 #==============================================================================
38 # -----------------------------------------------------------------------------
40 geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
41 myBuilder = salome.myStudy.NewBuilder()
42 gg = salome.ImportComponentGUI("GEOM")
44 ShapeTypeCompSolid = 1
57 p0 = geompy.MakeVertex(0., 0., 0.)
58 px = geompy.MakeVertex(100., 0., 0.)
59 py = geompy.MakeVertex(0., 100., 0.)
60 pz = geompy.MakeVertex(0., 0., 100.)
61 vx = geompy.MakeVector(p0, px)
62 vy = geompy.MakeVector(p0, py)
63 vz = geompy.MakeVector(p0, pz)
65 sphereExt = geompy.MakeSphere( 0., 0., 0., 400.)
66 sphereInt = geompy.MakeSphere( 0.,-50., 0., 350.)
67 sphereA = geompy.MakeSphere( -400., 50., 50., 400.)
68 sphereB = geompy.MakeSphere( 350.,-50.,-50., 350.)
69 ptcyle = geompy.MakeVertex(0., -300., -450.)
70 cylindre = geompy.MakeCylinder(ptcyle,vz,500.,900.)
72 vol1=geompy.MakeCut(sphereExt,sphereA)
73 vol2=geompy.MakeCut(vol1,sphereB)
74 vol3=geompy.MakeCut(vol2,cylindre)
75 blob=geompy.MakeCut(vol3,sphereInt)
77 idblob = geompy.addToStudy(blob,"blob")
80 aretes = geompy.SubShapeAllSorted(blob, ShapeTypeEdge)
83 # -------------------------------
84 # --- numerotation des aretes
86 ## edname="arete%d"%eid
87 ## idedge=geompy.addToStudy(edge,edname)
90 salome.sg.updateObjBrowser(1)
92 # --- epaisseur 0 2 8 10
93 # --- hauteur 1 3 9 11
96 # -----------------------------------------------------------------------------
98 print "-------------------------- mesh"
100 # ---- init a Mesh with the geom shape
102 mesh=smesh.Mesh(shape_mesh, "MeshBlob")
104 # ---- add hypothesis and algorithms to mesh
105 print "-------------------------- add hypothesis to mesh"
106 algo1 = mesh.Segment()
107 algo2 = mesh.Quadrangle()
108 algo3 = mesh.Hexahedron()
110 numberOfSegmentsA = 4
112 algo = mesh.Segment(aretes[0])
113 algo.NumberOfSegments(numberOfSegmentsA)
114 algo = mesh.Segment(aretes[2])
115 algo.NumberOfSegments(numberOfSegmentsA)
116 algo = mesh.Segment(aretes[8])
117 algo.NumberOfSegments(numberOfSegmentsA)
118 algo = mesh.Segment(aretes[10])
119 algo.NumberOfSegments(numberOfSegmentsA)
122 numberOfSegmentsC = 15
124 algo = mesh.Segment(aretes[1])
125 algo.NumberOfSegments(numberOfSegmentsC)
126 algo = mesh.Segment(aretes[3])
127 algo.NumberOfSegments(numberOfSegmentsC)
128 algo = mesh.Segment(aretes[9])
129 algo.NumberOfSegments(numberOfSegmentsC)
130 algo = mesh.Segment(aretes[11])
131 algo.NumberOfSegments(numberOfSegmentsC)
134 numberOfSegmentsB = 10
135 algo = mesh.Segment(aretes[4])
136 algo.NumberOfSegments(numberOfSegmentsB)
137 algo = mesh.Segment(aretes[5])
138 algo.NumberOfSegments(numberOfSegmentsB)
139 algo = mesh.Segment(aretes[6])
140 algo.NumberOfSegments(numberOfSegmentsB)
141 algo = mesh.Segment(aretes[7])
142 algo.NumberOfSegments(numberOfSegmentsB)
147 print "-------------------------- compute mesh"
151 #log=mesh.GetLog(0) # no erase trace
154 print "Information about the Mesh:"
155 print "Number of nodes : ", mesh.NbNodes()
156 print "Number of edges : ", mesh.NbEdges()
157 print "Number of faces : ", mesh.NbFaces()
158 print "Number of quadrangles : ", mesh.NbQuadrangles()
159 print "Number of volumes : ", mesh.NbVolumes()
160 print "Number of hexahedrons : ", mesh.NbHexas()
162 print "problem when Computing the mesh"
164 salome.sg.updateObjBrowser(1)