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