Salome HOME
7675de3fdc14eeb535bf31288c3bc4c3ec7d3bb1
[samples/datafiles.git] / Superv / Python / MacroWithGeomGates_py.py
1 #  Copyright (C) 2007-2008  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.
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 # Generated python file of Graph aNewDataFlow_1_4_1_1_1_1
23 #
24 from SuperV import *
25
26 # Graph creation of aNewDataFlow_1_4_1_1_1_1
27 def DefaNewDataFlow_1_4_1_1_1_1() :
28     aNewDataFlow_1_4_1_1_1_1 = Graph( 'aNewDataFlow_1_4_1_1_1_1' )
29     aNewDataFlow_1_4_1_1_1_1.SetName( 'aNewDataFlow_1_4_1_1_1_1' )
30     aNewDataFlow_1_4_1_1_1_1.SetAuthor( '' )
31     aNewDataFlow_1_4_1_1_1_1.SetComment( '' )
32     aNewDataFlow_1_4_1_1_1_1.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     Pygag = []
38     Pygag.append( 'from batchmode_geompy import *  ' )
39     Pygag.append( 'def gag():   ' )
40     Pygag.append( '    # This is a gag   ' )
41     Pygag.append( '    return 1   ' )
42     gag = aNewDataFlow_1_4_1_1_1_1.INode( 'gag' , Pygag )
43     gag.SetName( 'gag' )
44     gag.SetAuthor( '' )
45     gag.SetComment( 'Compute Node' )
46     gag.Coords( 0 , 123 )
47     IgagGate = gag.GetInPort( 'Gate' )
48     OgagGate = gag.GetOutPort( 'Gate' )
49     
50     PyMakeBox1 = []
51     PyMakeBox1.append( 'def MakeBox1(x1,y1,z1,x2,y2,z2):   ' )
52     PyMakeBox1.append( '    aBox = MakeBox(x1,y1,z1,x2,y2,z2)  ' )
53     PyMakeBox1.append( '    return aBox   ' )
54     MakeBox1 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeBox1' , PyMakeBox1 )
55     MakeBox1.SetName( 'MakeBox1' )
56     MakeBox1.SetAuthor( '' )
57     MakeBox1.SetComment( 'Compute Node' )
58     MakeBox1.Coords( 194 , 3 )
59     IMakeBox1x1 = MakeBox1.InPort( 'x1' , 'double' )
60     IMakeBox1y1 = MakeBox1.InPort( 'y1' , 'double' )
61     IMakeBox1z1 = MakeBox1.InPort( 'z1' , 'double' )
62     IMakeBox1x2 = MakeBox1.InPort( 'x2' , 'double' )
63     IMakeBox1y2 = MakeBox1.InPort( 'y2' , 'double' )
64     IMakeBox1z2 = MakeBox1.InPort( 'z2' , 'double' )
65     IMakeBox1Gate = MakeBox1.GetInPort( 'Gate' )
66     OMakeBox1shape = MakeBox1.OutPort( 'shape' , 'objref' )
67     OMakeBox1Gate = MakeBox1.GetOutPort( 'Gate' )
68     
69     PyMakeCopy_1 = []
70     PyMakeCopy_1.append( 'def MakeCopy_1(shape1):  ' )
71     PyMakeCopy_1.append( '    shape=MakeCopy(shape1) ' )
72     PyMakeCopy_1.append( '    return shape ' )
73     MakeCopy_1 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeCopy_1' , PyMakeCopy_1 )
74     MakeCopy_1.SetName( 'MakeCopy_1' )
75     MakeCopy_1.SetAuthor( '' )
76     MakeCopy_1.SetComment( 'Compute Node' )
77     MakeCopy_1.Coords( 389 , 3 )
78     IMakeCopy_1shape1 = MakeCopy_1.InPort( 'shape1' , 'objref' )
79     IMakeCopy_1Gate = MakeCopy_1.GetInPort( 'Gate' )
80     OMakeCopy_1shape = MakeCopy_1.OutPort( 'shape' , 'objref' )
81     OMakeCopy_1Gate = MakeCopy_1.GetOutPort( 'Gate' )
82     
83     PyMakeCopy_2 = []
84     PyMakeCopy_2.append( 'def MakeCopy_2(shape1):  ' )
85     PyMakeCopy_2.append( '    shape=MakeCopy(shape1)  ' )
86     PyMakeCopy_2.append( '    return shape ' )
87     MakeCopy_2 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeCopy_2' , PyMakeCopy_2 )
88     MakeCopy_2.SetName( 'MakeCopy_2' )
89     MakeCopy_2.SetAuthor( '' )
90     MakeCopy_2.SetComment( 'Compute Node' )
91     MakeCopy_2.Coords( 391 , 264 )
92     IMakeCopy_2shape1 = MakeCopy_2.InPort( 'shape1' , 'objref' )
93     IMakeCopy_2Gate = MakeCopy_2.GetInPort( 'Gate' )
94     OMakeCopy_2shape = MakeCopy_2.OutPort( 'shape' , 'objref' )
95     OMakeCopy_2Gate = MakeCopy_2.GetOutPort( 'Gate' )
96     
97     PyMakeSphere_1 = []
98     PyMakeSphere_1.append( 'def MakeSphere_1(x1,y1,z1,radius):   ' )
99     PyMakeSphere_1.append( '    apoint=MakeVertex(x1,y1,z1) ' )
100     PyMakeSphere_1.append( '    shape=MakeSpherePntR(apoint,radius) ' )
101     PyMakeSphere_1.append( '    return shape ' )
102     MakeSphere_1 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeSphere_1' , PyMakeSphere_1 )
103     MakeSphere_1.SetName( 'MakeSphere_1' )
104     MakeSphere_1.SetAuthor( '' )
105     MakeSphere_1.SetComment( 'Compute Node' )
106     MakeSphere_1.Coords( 641 , 326 )
107     IMakeSphere_1x1 = MakeSphere_1.InPort( 'x1' , 'double' )
108     IMakeSphere_1y1 = MakeSphere_1.InPort( 'y1' , 'double' )
109     IMakeSphere_1z1 = MakeSphere_1.InPort( 'z1' , 'double' )
110     IMakeSphere_1radius = MakeSphere_1.InPort( 'radius' , 'double' )
111     IMakeSphere_1Gate = MakeSphere_1.GetInPort( 'Gate' )
112     OMakeSphere_1shape = MakeSphere_1.OutPort( 'shape' , 'objref' )
113     OMakeSphere_1Gate = MakeSphere_1.GetOutPort( 'Gate' )
114     
115     PyMakeFuse_1 = []
116     PyMakeFuse_1.append( 'def MakeFuse_1(shape1,shape2): ' )
117     PyMakeFuse_1.append( '    # fuse operation 3 ' )
118     PyMakeFuse_1.append( '    shape = MakeBoolean(shape1,shape2,3)  ' )
119     PyMakeFuse_1.append( '    return shape ' )
120     MakeFuse_1 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeFuse_1' , PyMakeFuse_1 )
121     MakeFuse_1.SetName( 'MakeFuse_1' )
122     MakeFuse_1.SetAuthor( '' )
123     MakeFuse_1.SetComment( 'Compute Node' )
124     MakeFuse_1.Coords( 823 , 116 )
125     IMakeFuse_1shape1 = MakeFuse_1.InPort( 'shape1' , 'objref' )
126     IMakeFuse_1shape2 = MakeFuse_1.InPort( 'shape2' , 'objref' )
127     IMakeFuse_1Gate = MakeFuse_1.GetInPort( 'Gate' )
128     OMakeFuse_1shape = MakeFuse_1.OutPort( 'shape' , 'objref' )
129     OMakeFuse_1Gate = MakeFuse_1.GetOutPort( 'Gate' )
130     
131     PyMakeFuse_2 = []
132     PyMakeFuse_2.append( 'def MakeFuse_2(shape1,shape2):           ' )
133     PyMakeFuse_2.append( '    # fuse operation 3          ' )
134     PyMakeFuse_2.append( '    shape = MakeBoolean(shape1,shape2,3) ' )
135     PyMakeFuse_2.append( '    from SALOME_NamingServicePy import SALOME_NamingServicePy_i ' )
136     PyMakeFuse_2.append( '    myNamingService = SALOME_NamingServicePy_i(orb) ' )
137     PyMakeFuse_2.append( '    aSession = myNamingService.Resolve('/Kernel/Session') ' )
138     PyMakeFuse_2.append( '    aStudyId = aSession.GetActiveStudyId() ' )
139     PyMakeFuse_2.append( '    myStudyManager = myNamingService.Resolve('/myStudyManager') ' )
140     PyMakeFuse_2.append( '    aStudy = myStudyManager.GetStudyByID(aStudyId) ' )
141     PyMakeFuse_2.append( '    aSObject = geom.AddInStudy(aStudy, shape, "shape", None) ' )
142     PyMakeFuse_2.append( '    return shape ' )
143     MakeFuse_2 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeFuse_2' , PyMakeFuse_2 )
144     MakeFuse_2.SetName( 'MakeFuse_2' )
145     MakeFuse_2.SetAuthor( '' )
146     MakeFuse_2.SetComment( 'Compute Node' )
147     MakeFuse_2.Coords( 1049 , 295 )
148     IMakeFuse_2shape1 = MakeFuse_2.InPort( 'shape1' , 'objref' )
149     IMakeFuse_2shape2 = MakeFuse_2.InPort( 'shape2' , 'objref' )
150     IMakeFuse_2Gate = MakeFuse_2.GetInPort( 'Gate' )
151     OMakeFuse_2shape = MakeFuse_2.OutPort( 'shape' , 'objref' )
152     OMakeFuse_2Gate = MakeFuse_2.GetOutPort( 'Gate' )
153     
154     PyMakeTranslation_1 = []
155     PyMakeTranslation_1.append( 'def MakeTranslation_1(shape1,x1,y1,z1):   ' )
156     PyMakeTranslation_1.append( '    shape = MakeTranslation(shape1,x1,y1,z1)  ' )
157     PyMakeTranslation_1.append( '    return shape' )
158     MakeTranslation_1 = aNewDataFlow_1_4_1_1_1_1.INode( 'MakeTranslation_1' , PyMakeTranslation_1 )
159     MakeTranslation_1.SetName( 'MakeTranslation_1' )
160     MakeTranslation_1.SetAuthor( '' )
161     MakeTranslation_1.SetComment( 'Compute Node' )
162     MakeTranslation_1.Coords( 621 , 12 )
163     IMakeTranslation_1shape1 = MakeTranslation_1.InPort( 'shape1' , 'objref' )
164     IMakeTranslation_1x1 = MakeTranslation_1.InPort( 'x1' , 'double' )
165     IMakeTranslation_1y1 = MakeTranslation_1.InPort( 'y1' , 'double' )
166     IMakeTranslation_1z1 = MakeTranslation_1.InPort( 'z1' , 'double' )
167     IMakeTranslation_1Gate = MakeTranslation_1.GetInPort( 'Gate' )
168     OMakeTranslation_1shape = MakeTranslation_1.OutPort( 'shape' , 'objref' )
169     OMakeTranslation_1Gate = MakeTranslation_1.GetOutPort( 'Gate' )
170     
171     # Creation of Macro Nodes
172     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1 = DefaNewDataFlow_1_5_1_1_3_3_1_1_1_3_1()
173     Macro_aNewDataFlow_1_5_1_1 = aNewDataFlow_1_4_1_1_1_1.GraphMNode( aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1 )
174     Macro_aNewDataFlow_1_5_1_1.SetCoupled( 'aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1' )
175     Macro_aNewDataFlow_1_5_1_1.SetName( 'Macro_aNewDataFlow_1_5_1_1' )
176     Macro_aNewDataFlow_1_5_1_1.SetAuthor( '' )
177     Macro_aNewDataFlow_1_5_1_1.SetComment( 'Macro Node' )
178     Macro_aNewDataFlow_1_5_1_1.Coords( 391 , 121 )
179     IMacro_aNewDataFlow_1_5_1_1sum__a = Macro_aNewDataFlow_1_5_1_1.GetInPort( 'sum__a' )
180     IMacro_aNewDataFlow_1_5_1_1sum__b = Macro_aNewDataFlow_1_5_1_1.GetInPort( 'sum__b' )
181     IMacro_aNewDataFlow_1_5_1_1Gate = Macro_aNewDataFlow_1_5_1_1.GetInPort( 'Gate' )
182     OMacro_aNewDataFlow_1_5_1_1Mult__b = Macro_aNewDataFlow_1_5_1_1.GetOutPort( 'Mult__b' )
183     OMacro_aNewDataFlow_1_5_1_1Gate = Macro_aNewDataFlow_1_5_1_1.GetOutPort( 'Gate' )
184     
185     # Creation of Links
186     LgagGateMakeBox1Gate = aNewDataFlow_1_4_1_1_1_1.Link( OgagGate , IMakeBox1Gate )
187     
188     LMakeBox1shapeMakeCopy_1shape1 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeBox1shape , IMakeCopy_1shape1 )
189     
190     LMakeBox1shapeMakeCopy_2shape1 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeBox1shape , IMakeCopy_2shape1 )
191     LMakeBox1shapeMakeCopy_2shape1.AddCoord( 1 , 373 , 211 )
192     
193     LMakeBox1GateMakeCopy_1Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeBox1Gate , IMakeCopy_1Gate )
194     
195     LMakeCopy_1shapeMakeTranslation_1shape1 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeCopy_1shape , IMakeTranslation_1shape1 )
196     
197     LMakeCopy_1GateMakeCopy_2Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeCopy_1Gate , IMakeCopy_2Gate )
198     LMakeCopy_1GateMakeCopy_2Gate.AddCoord( 1 , 365 , 359 )
199     LMakeCopy_1GateMakeCopy_2Gate.AddCoord( 2 , 570 , 98 )
200     
201     LMakeCopy_2shapeMakeFuse_1shape2 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeCopy_2shape , IMakeFuse_1shape2 )
202     LMakeCopy_2shapeMakeFuse_1shape2.AddCoord( 1 , 674 , 207 )
203     
204     LMakeCopy_2GateMakeSphere_1Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeCopy_2Gate , IMakeSphere_1Gate )
205     
206     LMakeSphere_1shapeMakeFuse_2shape2 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeSphere_1shape , IMakeFuse_2shape2 )
207     
208     LMakeSphere_1GateMakeTranslation_1Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeSphere_1Gate , IMakeTranslation_1Gate )
209     LMakeSphere_1GateMakeTranslation_1Gate.AddCoord( 1 , 593 , 167 )
210     LMakeSphere_1GateMakeTranslation_1Gate.AddCoord( 2 , 828 , 481 )
211     
212     LMakeFuse_1shapeMakeFuse_2shape1 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeFuse_1shape , IMakeFuse_2shape1 )
213     LMakeFuse_1shapeMakeFuse_2shape1.AddCoord( 1 , 1017 , 366 )
214     LMakeFuse_1shapeMakeFuse_2shape1.AddCoord( 2 , 1017 , 187 )
215     
216     LMakeFuse_1GateMakeFuse_2Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeFuse_1Gate , IMakeFuse_2Gate )
217     LMakeFuse_1GateMakeFuse_2Gate.AddCoord( 1 , 1001 , 410 )
218     LMakeFuse_1GateMakeFuse_2Gate.AddCoord( 2 , 1001 , 231 )
219     
220     LMacro_aNewDataFlow_1_5_1_1Mult__bMakeTranslation_1y1 = aNewDataFlow_1_4_1_1_1_1.Link( OMacro_aNewDataFlow_1_5_1_1Mult__b , IMakeTranslation_1y1 )
221     
222     LMakeTranslation_1shapeMakeFuse_1shape1 = aNewDataFlow_1_4_1_1_1_1.Link( OMakeTranslation_1shape , IMakeFuse_1shape1 )
223     
224     LMakeTranslation_1GateMakeFuse_1Gate = aNewDataFlow_1_4_1_1_1_1.Link( OMakeTranslation_1Gate , IMakeFuse_1Gate )
225     
226     # Input datas
227     IMakeBox1x1.Input( 0 )
228     IMakeBox1y1.Input( 0 )
229     IMakeBox1z1.Input( 0 )
230     IMakeBox1x2.Input( 50 )
231     IMakeBox1y2.Input( 50 )
232     IMakeBox1z2.Input( 50 )
233     IMakeSphere_1x1.Input( 0 )
234     IMakeSphere_1y1.Input( 0 )
235     IMakeSphere_1z1.Input( 0 )
236     IMakeSphere_1radius.Input( 12 )
237     IMacro_aNewDataFlow_1_5_1_1sum__a.Input( 1 )
238     IMacro_aNewDataFlow_1_5_1_1sum__b.Input( 2 )
239     IMakeTranslation_1x1.Input( 25 )
240     IMakeTranslation_1z1.Input( 25 )
241     
242     # Output Ports of the graph
243     #OMakeFuse_2shape = MakeFuse_2.GetOutPort( 'shape' )
244     return aNewDataFlow_1_4_1_1_1_1
245
246 # Graph creation of aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1
247 def DefaNewDataFlow_1_5_1_1_3_3_1_1_1_3_1() :
248     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1 = Graph( 'aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1' )
249     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.SetCoupled( 'Macro_aNewDataFlow_1_5_1_1' )
250     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.SetName( 'aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1' )
251     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.SetAuthor( '' )
252     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.SetComment( '' )
253     aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.Coords( 0 , 0 )
254     
255     # Creation of Factory Nodes
256     
257     # Creation of InLine Nodes
258     Pysum = []
259     Pysum.append( 'def sum(a, b): ' )
260     Pysum.append( '   return a+b ' )
261     sum = aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.INode( 'sum' , Pysum )
262     sum.SetName( 'sum' )
263     sum.SetAuthor( '' )
264     sum.SetComment( 'Compute Node' )
265     sum.Coords( 52 , 80 )
266     Isuma = sum.InPort( 'a' , 'double' )
267     Isumb = sum.InPort( 'b' , 'double' )
268     IsumGate = sum.GetInPort( 'Gate' )
269     Osums = sum.OutPort( 's' , 'double' )
270     OsumGate = sum.GetOutPort( 'Gate' )
271     
272     PyMult = []
273     PyMult.append( 'def Mult(a): ' )
274     PyMult.append( '   b = a*3 ' )
275     PyMult.append( '   return b ' )
276     Mult = aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.INode( 'Mult' , PyMult )
277     Mult.SetName( 'Mult' )
278     Mult.SetAuthor( '' )
279     Mult.SetComment( 'Compute Node' )
280     Mult.Coords( 298 , 72 )
281     IMulta = Mult.InPort( 'a' , 'double' )
282     IMultGate = Mult.GetInPort( 'Gate' )
283     OMultb = Mult.OutPort( 'b' , 'double' )
284     OMultGate = Mult.GetOutPort( 'Gate' )
285     
286     # Creation of Links
287     LsumsMulta = aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1.Link( Osums , IMulta )
288     
289     # Input Ports of the graph
290     #Isuma = sum.GetInPort( 'a' )
291     #Isumb = sum.GetInPort( 'b' )
292     
293     # Output Ports of the graph
294     #OMultb = Mult.GetOutPort( 'b' )
295     return aNewDataFlow_1_5_1_1_3_3_1_1_1_3_1
296
297
298 aNewDataFlow_1_4_1_1_1_1 = DefaNewDataFlow_1_4_1_1_1_1()