Salome HOME
0022763: [EDF] Shape processing
[samples/datafiles.git] / Superv / Python / GraphEssai.py
1 # Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 # Generated python file of Graph GraphEssai
24 #
25 from SuperV import *
26 # Graph creation 
27 GraphEssai = Graph( 'GraphEssai' )
28 GraphEssai.SetName( 'GraphEssai' )
29 GraphEssai.SetAuthor( '' )
30 GraphEssai.SetComment( '' )
31 GraphEssai.Coords( 0 , 0 )
32
33 # Creation of Factory Nodes
34
35 Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
36 Add.SetName( 'Add' )
37 Add.SetAuthor( '' )
38 Add.SetContainer( 'FactoryServer' )
39 Add.SetComment( 'Add from AddComponent' )
40 Add.Coords( 15 , 241 )
41
42 Sub = GraphEssai.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
43 Sub.SetName( 'Sub' )
44 Sub.SetAuthor( '' )
45 Sub.SetContainer( 'FactoryServer' )
46 Sub.SetComment( 'Sub from SubComponent' )
47 Sub.Coords( 227 , 96 )
48
49 Mul = GraphEssai.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )
50 Mul.SetName( 'Mul' )
51 Mul.SetAuthor( '' )
52 Mul.SetContainer( 'FactoryServer' )
53 Mul.SetComment( 'Mul from MulComponent' )
54 Mul.Coords( 435 , 242 )
55
56 Div = GraphEssai.FNode( 'DivComponent' , 'DivComponent' , 'Div' )
57 Div.SetName( 'Div' )
58 Div.SetAuthor( '' )
59 Div.SetContainer( 'FactoryServer' )
60 Div.SetComment( 'Div from DivComponent' )
61 Div.Coords( 634 , 97 )
62
63 # Creation of Links
64 Addz = Add.Port( 'z' )
65 Muly = GraphEssai.Link( Addz , Mul.Port( 'y' ) )
66
67 Suby = GraphEssai.Link( Addz , Sub.Port( 'y' ) )
68 Suby.AddCoord( 1 , 197 , 204 )
69 Suby.AddCoord( 2 , 198 , 351 )
70
71 Subz = Sub.Port( 'z' )
72 Divx = GraphEssai.Link( Subz , Div.Port( 'x' ) )
73
74 Mulx = GraphEssai.Link( Subz , Mul.Port( 'x' ) )
75 Mulx.AddCoord( 1 , 411 , 323 )
76 Mulx.AddCoord( 2 , 411 , 177 )
77
78 Mulz = Mul.Port( 'z' )
79 Divy = GraphEssai.Link( Mulz , Div.Port( 'y' ) )
80 Divy.AddCoord( 1 , 612 , 207 )
81 Divy.AddCoord( 2 , 612 , 322 )
82
83 # Creation of Input datas
84 Addx = Add.Input( 'x' , 3)
85 Addy = Add.Input( 'y' , 4.5)
86 Subx = Sub.Input( 'x' , 1.5)
87
88 # Creation of Output variables
89 AddFuncValue = Add.Port( 'FuncValue' )
90 Divz = Div.Port( 'z' )
91
92 Add.Print()
93 Sub.Print()
94 Mul.Print()
95 Div.Print()
96
97 GraphEssai.PrintPorts()
98
99 nodes = GraphEssai.LevelNodes( 0 )
100 i = 0
101 while i < len( nodes ) :
102     print 'Nodes of level 0',nodes[i].Name()
103     i = i + 1
104
105 GraphEssai.Run()
106
107 GraphEssai.DoneW()
108
109 GraphEssai.State()
110
111 GraphEssai.PrintPorts()
112