1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2010 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
24 # ==================================
33 # an assembly of a box, a cylinder and a truncated cone meshed with tetrahedral.
52 box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
57 pt1 = MakeVertex(0, 0, cote/3)
58 di1 = MakeVectorDXDYDZ(0, 0, 1)
59 cyl = MakeCylinder(pt1, di1, section, size)
61 # Build a truncated cone
62 # ----------------------
64 pt2 = MakeVertex(0, 0, size)
65 cone = MakeCone(pt2, di1, radius_1, radius_2, height)
70 box_cyl = MakeFuse(box, cyl)
71 piece = MakeFuse(box_cyl, cone)
76 addToStudy(piece, name)
78 # Create a group of faces
79 # -----------------------
81 group = CreateGroup(piece, ShapeType["FACE"])
83 group_name = name + "_grp"
84 addToStudy(group, group_name)
85 group.SetName(group_name)
87 # Add faces in the group
88 # ----------------------
90 faces = SubShapeAllIDs(piece, ShapeType["FACE"])
92 UnionIDs(group, faces)
97 smesh.SetCurrentStudy(salome.myStudy)
99 # Define a mesh on a geometry
100 # ---------------------------
102 tetra = smesh.Mesh(piece, name)
104 # Define 1D hypothesis
105 # --------------------
107 algo1d = tetra.Segment()
108 algo1d.LocalLength(10)
110 # Define 2D hypothesis
111 # --------------------
113 algo2d = tetra.Triangle()
114 algo2d.LengthFromEdges()
116 # Define 3D hypothesis
117 # --------------------
119 algo3d = tetra.Tetrahedron(smesh.NETGEN)
120 algo3d.MaxElementVolume(100)
127 # Create a groupe of faces
128 # ------------------------