1 # Copyright (C) 2003 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
34 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
35 idbox = geompy.addToStudy(box, "box")
37 # ---- add faces of box to study
38 print "Add faces to study"
40 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
41 for f in subShapeList:
42 name = geompy.SubShapeName(f, box)
44 idface.append( geompy.addToStudyInFather(box, f, name) )
46 # ---- add edges of box to study
47 print "Add edges to study"
49 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
50 for f in subShapeList:
51 name = geompy.SubShapeName(f, box)
53 idedge.append( geompy.addToStudyInFather(box, f, name) )
55 salome.sg.updateObjBrowser(1);
58 smeshgui = salome.ImportComponentGUI("SMESH")
59 smeshgui.Init(salome.myStudyId)
62 # ---- Creating meshes
64 box = salome.IDToObject(idbox)
65 names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]
68 print "-------------------------- Create ", names[0], " mesh"
69 mesh = smesh.Mesh(box, names[0])
71 hyp = algo.NumberOfSegments(7)
73 smesh.SetName(hyp, "NumberOfSegmentsReg")
74 algo = mesh.Triangle()
75 algo.MaxElementArea(2500)
77 print "-------------------------- Create ", names[1], " mesh"
78 mesh = smesh.Mesh(box, names[1])
80 hyp = algo.NumberOfSegments(7)
83 smesh.SetName(hyp, "NumberOfSegmentsScale")
84 algo = mesh.Triangle()
85 algo.MaxElementArea(2500)
87 print "-------------------------- Create ", names[2], " mesh"
88 mesh = smesh.Mesh(box,names[2])
90 hyp = algo.NumberOfSegments(7)
92 hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
93 hyp.SetConversionMode(0)
94 smesh.SetName(hyp, "NumberOfSegmentsTable")
95 algo = mesh.Triangle()
96 algo.MaxElementArea(2500)
98 print "-------------------------- Create ", names[3], " mesh"
99 mesh = smesh.Mesh(box, names[3])
100 algo = mesh.Segment()
101 hyp = algo.NumberOfSegments(10)
103 hyp.SetExpressionFunction("sin(3*t)")
104 hyp.SetConversionMode(1)
105 smesh.SetName(hyp, "NumberOfSegmentsExpr")
106 algo = mesh.Triangle()
107 algo.MaxElementArea(2500)
110 salome.sg.updateObjBrowser(1);