Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SALOME_SWIG / test_big_table.py
1 # Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either 
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful 
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public  
14 # License along with this library; if not, write to the Free Software 
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 #  File   : test_big_table.py
20 #  Author : Vadim SANDLER
21 #  Module : SALOME
22 #  $Header$
23
24 import salome
25 import math
26 import SALOMEDS
27
28 # >>> Getting study builder ==================================================
29 myStudy = salome.myStudy
30 myBuilder = myStudy.NewBuilder()
31
32 # >>> Creating virtual component =============================================
33 myComponent = myStudy.FindComponent("VirtualComponent")
34 if not myComponent:
35    myComponent = myBuilder.NewComponent("VirtualComponent")
36    aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
37    aName.SetValue("VirtualComponent")
38
39 # >>> Creating object with Table of real[ 200 * 20 ] ========================
40 myTRealObject = myBuilder.NewObject(myComponent)
41 AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
42 AName.SetValue("Table Of Real")
43 ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
44 myHorNb = 10
45 myVerNb = 200
46
47 k={}
48 for j in range(0,myHorNb):
49    k[j] = j*10+1
50 ARealTable.AddRow(k.values())
51 ARealTable.SetRowTitle(1, "Frequency")
52 ARealTable.SetRowUnit(1, "Hz")
53
54 for i in range(1,myVerNb+1):
55    for j in range(0,myHorNb):
56       if j % 2 == 1:
57          k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
58       else:
59          k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5 
60    ARealTable.AddRow(k.values())
61    ARealTable.SetRowTitle(i+1, "Power " + str(i))
62    ARealTable.SetRowUnit(i+1, "Wt")
63 ARealTable.SetTitle("Very useful data")
64
65 # >>> Updating Object Browser ================================================
66 salome.sg.updateObjBrowser(1)
67
68 # ============================================================================