Salome HOME
Copyrights update 2015.
[samples/datafiles.git] / Superv / Python / MacroWithGeom.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 aNewDataFlow
24 #
25 from SuperV import *
26
27 # Graph creation of aNewDataFlow
28 def DefaNewDataFlow() :
29     aNewDataFlow = Graph( 'aNewDataFlow' )
30     aNewDataFlow.SetName( 'aNewDataFlow' )
31     aNewDataFlow.SetAuthor( '' )
32     aNewDataFlow.SetComment( '' )
33     aNewDataFlow.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     TranslateDXDYDZ = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'TranslateDXDYDZ' )
38     TranslateDXDYDZ.SetName( 'TranslateDXDYDZ' )
39     TranslateDXDYDZ.SetAuthor( '' )
40     TranslateDXDYDZ.SetContainer( 'localhost/FactoryServer' )
41     TranslateDXDYDZ.SetComment( 'TranslateDXDYDZ from GEOM_Superv' )
42     TranslateDXDYDZ.Coords( 735 , 14 )
43     ITranslateDXDYDZtheObject = TranslateDXDYDZ.GetInPort( 'theObject' )
44     ITranslateDXDYDZtheDX = TranslateDXDYDZ.GetInPort( 'theDX' )
45     ITranslateDXDYDZtheDY = TranslateDXDYDZ.GetInPort( 'theDY' )
46     ITranslateDXDYDZtheDZ = TranslateDXDYDZ.GetInPort( 'theDZ' )
47     ITranslateDXDYDZGate = TranslateDXDYDZ.GetInPort( 'Gate' )
48     OTranslateDXDYDZreturn = TranslateDXDYDZ.GetOutPort( 'return' )
49     OTranslateDXDYDZGate = TranslateDXDYDZ.GetOutPort( 'Gate' )
50     
51     MakeCopy = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeCopy' )
52     MakeCopy.SetName( 'MakeCopy' )
53     MakeCopy.SetAuthor( '' )
54     MakeCopy.SetContainer( 'localhost/FactoryServer' )
55     MakeCopy.SetComment( 'MakeCopy from GEOM_Superv' )
56     MakeCopy.Coords( 477 , 14 )
57     IMakeCopytheOriginal = MakeCopy.GetInPort( 'theOriginal' )
58     IMakeCopyGate = MakeCopy.GetInPort( 'Gate' )
59     OMakeCopyreturn = MakeCopy.GetOutPort( 'return' )
60     OMakeCopyGate = MakeCopy.GetOutPort( 'Gate' )
61     
62     MakeBox = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeBox' )
63     MakeBox.SetName( 'MakeBox' )
64     MakeBox.SetAuthor( '' )
65     MakeBox.SetContainer( 'localhost/FactoryServer' )
66     MakeBox.SetComment( 'MakeBox from GEOM_Superv' )
67     MakeBox.Coords( 219 , 14 )
68     IMakeBoxtheX1 = MakeBox.GetInPort( 'theX1' )
69     IMakeBoxtheY1 = MakeBox.GetInPort( 'theY1' )
70     IMakeBoxtheZ1 = MakeBox.GetInPort( 'theZ1' )
71     IMakeBoxtheX2 = MakeBox.GetInPort( 'theX2' )
72     IMakeBoxtheY2 = MakeBox.GetInPort( 'theY2' )
73     IMakeBoxtheZ2 = MakeBox.GetInPort( 'theZ2' )
74     IMakeBoxGate = MakeBox.GetInPort( 'Gate' )
75     OMakeBoxreturn = MakeBox.GetOutPort( 'return' )
76     OMakeBoxGate = MakeBox.GetOutPort( 'Gate' )
77     
78     MakeCopy_1 = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeCopy' )
79     MakeCopy_1.SetName( 'MakeCopy_1' )
80     MakeCopy_1.SetAuthor( '' )
81     MakeCopy_1.SetContainer( 'localhost/FactoryServer' )
82     MakeCopy_1.SetComment( 'MakeCopy from GEOM_Superv' )
83     MakeCopy_1.Coords( 482 , 306 )
84     IMakeCopy_1theOriginal = MakeCopy_1.GetInPort( 'theOriginal' )
85     IMakeCopy_1Gate = MakeCopy_1.GetInPort( 'Gate' )
86     OMakeCopy_1return = MakeCopy_1.GetOutPort( 'return' )
87     OMakeCopy_1Gate = MakeCopy_1.GetOutPort( 'Gate' )
88     
89     MakeFuse = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeFuse' )
90     MakeFuse.SetName( 'MakeFuse' )
91     MakeFuse.SetAuthor( '' )
92     MakeFuse.SetContainer( 'localhost/FactoryServer' )
93     MakeFuse.SetComment( 'MakeFuse from GEOM_Superv' )
94     MakeFuse.Coords( 950 , 121 )
95     IMakeFusetheShape1 = MakeFuse.GetInPort( 'theShape1' )
96     IMakeFusetheShape2 = MakeFuse.GetInPort( 'theShape2' )
97     IMakeFuseGate = MakeFuse.GetInPort( 'Gate' )
98     OMakeFusereturn = MakeFuse.GetOutPort( 'return' )
99     OMakeFuseGate = MakeFuse.GetOutPort( 'Gate' )
100     
101     MakeSphere = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeSphere' )
102     MakeSphere.SetName( 'MakeSphere' )
103     MakeSphere.SetAuthor( '' )
104     MakeSphere.SetContainer( 'localhost/FactoryServer' )
105     MakeSphere.SetComment( 'MakeSphere from GEOM_Superv' )
106     MakeSphere.Coords( 227 , 409 )
107     IMakeSpheretheX = MakeSphere.GetInPort( 'theX' )
108     IMakeSpheretheY = MakeSphere.GetInPort( 'theY' )
109     IMakeSpheretheZ = MakeSphere.GetInPort( 'theZ' )
110     IMakeSpheretheRadius = MakeSphere.GetInPort( 'theRadius' )
111     IMakeSphereGate = MakeSphere.GetInPort( 'Gate' )
112     OMakeSpherereturn = MakeSphere.GetOutPort( 'return' )
113     OMakeSphereGate = MakeSphere.GetOutPort( 'Gate' )
114     
115     MakeFuse_1 = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'MakeFuse' )
116     MakeFuse_1.SetName( 'MakeFuse_1' )
117     MakeFuse_1.SetAuthor( '' )
118     MakeFuse_1.SetContainer( 'localhost/FactoryServer' )
119     MakeFuse_1.SetComment( 'MakeFuse from GEOM_Superv' )
120     MakeFuse_1.Coords( 1217 , 389 )
121     IMakeFuse_1theShape1 = MakeFuse_1.GetInPort( 'theShape1' )
122     IMakeFuse_1theShape2 = MakeFuse_1.GetInPort( 'theShape2' )
123     IMakeFuse_1Gate = MakeFuse_1.GetInPort( 'Gate' )
124     OMakeFuse_1return = MakeFuse_1.GetOutPort( 'return' )
125     OMakeFuse_1Gate = MakeFuse_1.GetOutPort( 'Gate' )
126     
127     SetStudyID = aNewDataFlow.FNode( 'GEOM_Superv' , 'GEOM_Superv' , 'SetStudyID' )
128     SetStudyID.SetName( 'SetStudyID' )
129     SetStudyID.SetAuthor( '' )
130     SetStudyID.SetContainer( 'localhost/FactoryServer' )
131     SetStudyID.SetComment( 'SetStudyID from GEOM_Superv' )
132     SetStudyID.Coords( 7 , 269 )
133     ISetStudyIDtheStudyID = SetStudyID.GetInPort( 'theStudyID' )
134     ISetStudyIDGate = SetStudyID.GetInPort( 'Gate' )
135     OSetStudyIDGate = SetStudyID.GetOutPort( 'Gate' )
136     
137     # Creation of Macro Nodes
138     aNewDataFlow_1 = DefaNewDataFlow_1()
139     Macro_aNewDataFlow_1 = aNewDataFlow.GraphMNode( aNewDataFlow_1 )
140     Macro_aNewDataFlow_1.SetCoupled( 'aNewDataFlow_1' )
141     Macro_aNewDataFlow_1.SetName( 'Macro_aNewDataFlow_1' )
142     Macro_aNewDataFlow_1.SetAuthor( '' )
143     Macro_aNewDataFlow_1.SetComment( 'Macro Node' )
144     Macro_aNewDataFlow_1.Coords( 480 , 145 )
145     IMacro_aNewDataFlow_1sum__a = Macro_aNewDataFlow_1.GetInPort( 'sum__a' )
146     IMacro_aNewDataFlow_1sum__b = Macro_aNewDataFlow_1.GetInPort( 'sum__b' )
147     IMacro_aNewDataFlow_1Gate = Macro_aNewDataFlow_1.GetInPort( 'Gate' )
148     OMacro_aNewDataFlow_1Mult__b = Macro_aNewDataFlow_1.GetOutPort( 'Mult__b' )
149     OMacro_aNewDataFlow_1Gate = Macro_aNewDataFlow_1.GetOutPort( 'Gate' )
150     
151     # Creation of Links
152     LMacro_aNewDataFlow_1Mult__bTranslateDXDYDZtheDY = aNewDataFlow.Link( OMacro_aNewDataFlow_1Mult__b , ITranslateDXDYDZtheDY )
153     
154     LTranslateDXDYDZreturnMakeFusetheShape1 = aNewDataFlow.Link( OTranslateDXDYDZreturn , IMakeFusetheShape1 )
155     
156     LMakeCopyreturnTranslateDXDYDZtheObject = aNewDataFlow.Link( OMakeCopyreturn , ITranslateDXDYDZtheObject )
157     
158     LMakeBoxreturnMakeCopytheOriginal = aNewDataFlow.Link( OMakeBoxreturn , IMakeCopytheOriginal )
159     
160     LMakeBoxreturnMakeCopy_1theOriginal = aNewDataFlow.Link( OMakeBoxreturn , IMakeCopy_1theOriginal )
161     
162     LMakeCopy_1returnMakeFusetheShape2 = aNewDataFlow.Link( OMakeCopy_1return , IMakeFusetheShape2 )
163     
164     LMakeFusereturnMakeFuse_1theShape1 = aNewDataFlow.Link( OMakeFusereturn , IMakeFuse_1theShape1 )
165     
166     LMakeSpherereturnMakeFuse_1theShape2 = aNewDataFlow.Link( OMakeSpherereturn , IMakeFuse_1theShape2 )
167     
168     LSetStudyIDGateMakeBoxGate = aNewDataFlow.Link( OSetStudyIDGate , IMakeBoxGate )
169     
170     LSetStudyIDGateMakeSphereGate = aNewDataFlow.Link( OSetStudyIDGate , IMakeSphereGate )
171     
172     # Input datas
173     IMacro_aNewDataFlow_1sum__a.Input( 1 )
174     IMacro_aNewDataFlow_1sum__b.Input( 2 )
175     ITranslateDXDYDZtheDX.Input( 25 )
176     ITranslateDXDYDZtheDZ.Input( 25 )
177     IMakeBoxtheX1.Input( 0 )
178     IMakeBoxtheY1.Input( 0 )
179     IMakeBoxtheZ1.Input( 0 )
180     IMakeBoxtheX2.Input( 50 )
181     IMakeBoxtheY2.Input( 50 )
182     IMakeBoxtheZ2.Input( 50 )
183     IMakeSpheretheX.Input( 0 )
184     IMakeSpheretheY.Input( 0 )
185     IMakeSpheretheZ.Input( 0 )
186     IMakeSpheretheRadius.Input( 12 )
187     ISetStudyIDtheStudyID.Input( 1 )
188     
189     # Output Ports of the graph
190     #OMakeFuse_1return = MakeFuse_1.GetOutPort( 'return' )
191     return aNewDataFlow
192
193 # Graph creation of aNewDataFlow_1
194 def DefaNewDataFlow_1() :
195     aNewDataFlow_1 = Graph( 'aNewDataFlow_1' )
196     aNewDataFlow_1.SetCoupled( 'Macro_aNewDataFlow_1' )
197     aNewDataFlow_1.SetName( 'aNewDataFlow_1' )
198     aNewDataFlow_1.SetAuthor( '' )
199     aNewDataFlow_1.SetComment( '' )
200     aNewDataFlow_1.Coords( 0 , 0 )
201     
202     # Creation of Factory Nodes
203     
204     # Creation of InLine Nodes
205     PyMult = []
206     PyMult.append( 'def Mult(a): ' )
207     PyMult.append( '   b = a*3 ' )
208     PyMult.append( '   return b ' )
209     Mult = aNewDataFlow_1.INode( 'Mult' , PyMult )
210     Mult.SetName( 'Mult' )
211     Mult.SetAuthor( '' )
212     Mult.SetComment( 'Compute Node' )
213     Mult.Coords( 382 , 78 )
214     IMulta = Mult.InPort( 'a' , 'double' )
215     IMultGate = Mult.GetInPort( 'Gate' )
216     OMultb = Mult.OutPort( 'b' , 'double' )
217     OMultGate = Mult.GetOutPort( 'Gate' )
218     
219     Pysum = []
220     Pysum.append( 'def sum(a, b): ' )
221     Pysum.append( '   return a+b' )
222     sum = aNewDataFlow_1.INode( 'sum' , Pysum )
223     sum.SetName( 'sum' )
224     sum.SetAuthor( '' )
225     sum.SetComment( 'Compute Node' )
226     sum.Coords( 47 , 87 )
227     Isuma = sum.InPort( 'a' , 'double' )
228     Isumb = sum.InPort( 'b' , 'double' )
229     IsumGate = sum.GetInPort( 'Gate' )
230     Osums = sum.OutPort( 's' , 'double' )
231     OsumGate = sum.GetOutPort( 'Gate' )
232     
233     # Creation of Links
234     LsumsMulta = aNewDataFlow_1.Link( Osums , IMulta )
235     
236     # Input Ports of the graph
237     #Isuma = sum.GetInPort( 'a' )
238     #Isumb = sum.GetInPort( 'b' )
239     
240     # Output Ports of the graph
241     #OMultb = Mult.GetOutPort( 'b' )
242     return aNewDataFlow_1
243
244
245 aNewDataFlow = DefaNewDataFlow()