2 # -*- coding: iso-8859-1 -*-
3 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
5 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # VISU VISU_SWIG : binding of C++ implementation and Python
25 # File : visu_big_table.py
26 # Author : Vadim SANDLER
35 # >>> Getting study builder ==================================================
36 myStudy = salome.myStudy
37 myBuilder = myStudy.NewBuilder()
39 # >>> Getting (loading) VISU component =======================================
40 myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
41 myComponent = myStudy.FindComponent("VISU")
42 myVisu.SetCurrentStudy(myStudy)
44 myComponent = myBuilder.NewComponent("VISU")
45 aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
46 #aName.SetValue("Visu")
47 aName.SetValue( salome.sg.getComponentUserName("VISU") )
49 A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
50 aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
51 aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
53 myBuilder.DefineComponentInstance(myComponent,myVisu)
55 # >>> Creating object with Table of real[ 200 * 20 ] ========================
56 myTRealObject = myBuilder.NewObject(myComponent)
57 AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
58 AName.SetValue("Table Of Real")
59 ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
64 for j in range(0,myHorNb):
66 ARealTable.AddRow(k.values())
67 ARealTable.SetRowTitle(1, "Frequency")
68 ARealTable.SetRowUnit(1, "Hz")
70 for i in range(1,myVerNb+1):
71 for j in range(0,myHorNb):
73 k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
75 k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5
76 ARealTable.AddRow(k.values())
77 ARealTable.SetRowTitle(i+1, "Power " + str(i))
78 ARealTable.SetRowUnit(i+1, "Wt")
79 ARealTable.SetTitle("Very useful data")
81 # >>> Create Visu table
82 myVisuTableReal = myVisu.CreateTable( myTRealObject.GetID() )
84 # >>> Create container and insert curves
85 myContainer = myVisu.CreateContainer()
88 for i in range(1,myVerNb+1):
89 myCurve = myVisu.CreateCurve( myVisuTableReal, 1, i+1 )
90 myContainer.AddCurve(myCurve)
92 # >>> Updating Object Browser ================================================
93 salome.sg.updateObjBrowser(1)
95 # ============================================================================