2 # Copyright (C) 2007-2011 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
23 #==============================================================================
24 # File : GraphExample.py
25 # Created : 18 déc 2001
26 # Author : Jean Rahuel
28 #==============================================================================
29 #from GraphExample import *
33 myGraph = Graph( "myDataFlow" )
35 Add = myGraph.Node( "AddComponent" , "AddInterface" , "Add" )
36 print Add.SetContainer('dm2s0017')
37 Sub = myGraph.Node( "SubComponent" , "SubInterface" , "Sub" )
38 print Sub.SetContainer('dm2s0018')
39 Mul = myGraph.Node( "MulComponent" , "MulInterface" , "Mul" )
40 print Mul.SetContainer('dm2s0019')
41 Div = myGraph.Node( "DivComponent" , "DivInterface" , "Div" )
42 print Div.SetContainer('dm2s0020')
46 Suby = myGraph.Link( PAddz , PSuby )
47 Muly = myGraph.Link( Add.Port("z") , Mul.Port("y") )
48 Mulx = myGraph.Link( Sub.Port( "z" ) , Mul.Port("x") )
49 Divx = myGraph.Link( Sub.Port( "z" ) , Div.Port("x") )
50 Divy = myGraph.Link( Mul.Port( "z" ) , Div.Port("y") )
52 Addx = Add.Input( "x" , 3 )
53 Addy = Add.Input( "y" , 4.5 )
54 Subx = Sub.Input( "x" , "1.5" )
56 print "Add(x) input value : ",Addx.ToString()
57 print "Add(y) input value : ",Addy.ToString()
58 print "Sub(x) input value : ",Subx.ToString()
64 print myGraph.IsValid()
65 print myGraph.IsExecutable()
69 Addz = Add.Port( "z" )
70 AddFuncValue = Add.Port( "FuncValue" )
71 Subz = Sub.Port( "z" )
72 Mulz = Mul.Port( "z" )
73 Divz = Div.Port( "z" )
75 print AddFuncValue.Done()
87 print AddFuncValue.ToString()