2 # Copyright (C) 2007-2014 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, or (at your option) any later version.
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
24 #==============================================================================
25 # File : GraphExample.py
26 # Created : 18 d?c 2001
27 # Author : Jean Rahuel
29 #==============================================================================
30 #from GraphExample import *
34 myGraph = Graph( "myDataFlow" )
36 Add = myGraph.Node( "AddComponent" , "AddInterface" , "Add" )
37 print Add.SetContainer('dm2s0017')
38 Sub = myGraph.Node( "SubComponent" , "SubInterface" , "Sub" )
39 print Sub.SetContainer('dm2s0018')
40 Mul = myGraph.Node( "MulComponent" , "MulInterface" , "Mul" )
41 print Mul.SetContainer('dm2s0019')
42 Div = myGraph.Node( "DivComponent" , "DivInterface" , "Div" )
43 print Div.SetContainer('dm2s0020')
47 Suby = myGraph.Link( PAddz , PSuby )
48 Muly = myGraph.Link( Add.Port("z") , Mul.Port("y") )
49 Mulx = myGraph.Link( Sub.Port( "z" ) , Mul.Port("x") )
50 Divx = myGraph.Link( Sub.Port( "z" ) , Div.Port("x") )
51 Divy = myGraph.Link( Mul.Port( "z" ) , Div.Port("y") )
53 Addx = Add.Input( "x" , 3 )
54 Addy = Add.Input( "y" , 4.5 )
55 Subx = Sub.Input( "x" , "1.5" )
57 print "Add(x) input value : ",Addx.ToString()
58 print "Add(y) input value : ",Addy.ToString()
59 print "Sub(x) input value : ",Subx.ToString()
65 print myGraph.IsValid()
66 print myGraph.IsExecutable()
70 Addz = Add.Port( "z" )
71 AddFuncValue = Add.Port( "FuncValue" )
72 Subz = Sub.Port( "z" )
73 Mulz = Mul.Port( "z" )
74 Divz = Div.Port( "z" )
76 print AddFuncValue.Done()
88 print AddFuncValue.ToString()