1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2012 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
36 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
37 idbox = geompy.addToStudy(box, "box")
39 # ---- add faces of box to study
40 print "Add faces to study"
42 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
43 for f in subShapeList:
44 name = geompy.SubShapeName(f, box)
46 idface.append( geompy.addToStudyInFather(box, f, name) )
48 # ---- add edges of box to study
49 print "Add edges to study"
51 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"])
52 for f in subShapeList:
53 name = geompy.SubShapeName(f, box)
55 idedge.append( geompy.addToStudyInFather(box, f, name) )
57 salome.sg.updateObjBrowser(1);
60 smeshgui = salome.ImportComponentGUI("SMESH")
61 smeshgui.Init(salome.myStudyId)
62 smesh.SetCurrentStudy(salome.myStudy)
64 # ---- Creating meshes
66 box = salome.IDToObject(idbox)
67 names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ]
70 print "-------------------------- Create ", names[0], " mesh"
71 mesh = smesh.Mesh(box, names[0])
73 hyp = algo.NumberOfSegments(7)
75 smesh.SetName(hyp, "NumberOfSegmentsReg")
76 algo = mesh.Triangle()
77 algo.MaxElementArea(2500)
79 print "-------------------------- Create ", names[1], " mesh"
80 mesh = smesh.Mesh(box, names[1])
82 hyp = algo.NumberOfSegments(7)
85 smesh.SetName(hyp, "NumberOfSegmentsScale")
86 algo = mesh.Triangle()
87 algo.MaxElementArea(2500)
89 print "-------------------------- Create ", names[2], " mesh"
90 mesh = smesh.Mesh(box,names[2])
92 hyp = algo.NumberOfSegments(7)
94 hyp.SetTableFunction( [0, 0.1, 0.5, 1.0, 1.0, 0.1] )
95 hyp.SetConversionMode(0)
96 smesh.SetName(hyp, "NumberOfSegmentsTable")
97 algo = mesh.Triangle()
98 algo.MaxElementArea(2500)
100 print "-------------------------- Create ", names[3], " mesh"
101 mesh = smesh.Mesh(box, names[3])
102 algo = mesh.Segment()
103 hyp = algo.NumberOfSegments(10)
105 hyp.SetExpressionFunction("sin(3*t)")
106 hyp.SetConversionMode(1)
107 smesh.SetName(hyp, "NumberOfSegmentsExpr")
108 algo = mesh.Triangle()
109 algo.MaxElementArea(2500)
112 salome.sg.updateObjBrowser(1);