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