Salome HOME
Update copyrights 2014.
[samples/datafiles.git] / Superv / Python / GeomGraph_py.py
1 # Copyright (C) 2007-2014  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_2_1_1_2_2_1_1
24 #
25 from SuperV import *
26
27 # Graph creation of aNewDataFlow_1_4_2_1_1_2_2_1_1
28 def DefaNewDataFlow_1_4_2_1_1_2_2_1_1() :
29     aNewDataFlow_1_4_2_1_1_2_2_1_1 = Graph( 'aNewDataFlow_1_4_2_1_1_2_2_1_1' )
30     aNewDataFlow_1_4_2_1_1_2_2_1_1.SetName( 'aNewDataFlow_1_4_2_1_1_2_2_1_1' )
31     aNewDataFlow_1_4_2_1_1_2_2_1_1.SetAuthor( '' )
32     aNewDataFlow_1_4_2_1_1_2_2_1_1.SetComment( '' )
33     aNewDataFlow_1_4_2_1_1_2_2_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_2_1_1_2_2_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_2_1_1_2_2_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_2_1_1_2_2_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_2_1_1_2_2_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( 389 , 136 )
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_2_1_1_2_2_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( 203 , 315 )
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     PyMakeTranslation_1 = []
117     PyMakeTranslation_1.append( 'def MakeTranslation_1(shape1,x1,y1,z1):   ' )
118     PyMakeTranslation_1.append( '    shape = MakeTranslation(shape1,x1,y1,z1)  ' )
119     PyMakeTranslation_1.append( '    return shape  ' )
120     MakeTranslation_1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.INode( 'MakeTranslation_1' , PyMakeTranslation_1 )
121     MakeTranslation_1.SetName( 'MakeTranslation_1' )
122     MakeTranslation_1.SetAuthor( '' )
123     MakeTranslation_1.SetComment( 'Compute Node' )
124     MakeTranslation_1.Coords( 596 , 3 )
125     IMakeTranslation_1shape1 = MakeTranslation_1.InPort( 'shape1' , 'objref' )
126     IMakeTranslation_1x1 = MakeTranslation_1.InPort( 'x1' , 'double' )
127     IMakeTranslation_1y1 = MakeTranslation_1.InPort( 'y1' , 'double' )
128     IMakeTranslation_1z1 = MakeTranslation_1.InPort( 'z1' , 'double' )
129     IMakeTranslation_1Gate = MakeTranslation_1.GetInPort( 'Gate' )
130     OMakeTranslation_1shape = MakeTranslation_1.OutPort( 'shape' , 'objref' )
131     OMakeTranslation_1Gate = MakeTranslation_1.GetOutPort( 'Gate' )
132     
133     PyMakeFuse_1 = []
134     PyMakeFuse_1.append( 'def MakeFuse_1(shape1,shape2): ' )
135     PyMakeFuse_1.append( '    # fuse operation 3 ' )
136     PyMakeFuse_1.append( '    shape = MakeBoolean(shape1,shape2,3)  ' )
137     PyMakeFuse_1.append( '    return shape ' )
138     MakeFuse_1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.INode( 'MakeFuse_1' , PyMakeFuse_1 )
139     MakeFuse_1.SetName( 'MakeFuse_1' )
140     MakeFuse_1.SetAuthor( '' )
141     MakeFuse_1.SetComment( 'Compute Node' )
142     MakeFuse_1.Coords( 823 , 116 )
143     IMakeFuse_1shape1 = MakeFuse_1.InPort( 'shape1' , 'objref' )
144     IMakeFuse_1shape2 = MakeFuse_1.InPort( 'shape2' , 'objref' )
145     IMakeFuse_1Gate = MakeFuse_1.GetInPort( 'Gate' )
146     OMakeFuse_1shape = MakeFuse_1.OutPort( 'shape' , 'objref' )
147     OMakeFuse_1Gate = MakeFuse_1.GetOutPort( 'Gate' )
148     
149     PyMakeFuse_2 = []
150     PyMakeFuse_2.append( 'def MakeFuse_2(shape1,shape2):           ' )
151     PyMakeFuse_2.append( '    # fuse operation 3          ' )
152     PyMakeFuse_2.append( '    shape = MakeBoolean(shape1,shape2,3) ' )
153     PyMakeFuse_2.append( '    from SALOME_NamingServicePy import SALOME_NamingServicePy_i ' )
154     PyMakeFuse_2.append( '    myNamingService = SALOME_NamingServicePy_i(orb) ' )
155     PyMakeFuse_2.append( '    aSession = myNamingService.Resolve('/Kernel/Session') ' )
156     PyMakeFuse_2.append( '    aStudyId = aSession.GetActiveStudyId() ' )
157     PyMakeFuse_2.append( '    myStudyManager = myNamingService.Resolve('/myStudyManager') ' )
158     PyMakeFuse_2.append( '    aStudy = myStudyManager.GetStudyByID(aStudyId) ' )
159     PyMakeFuse_2.append( '    aSObject = geom.AddInStudy(aStudy, shape, "shape", None) ' )
160     PyMakeFuse_2.append( '    return shape ' )
161     MakeFuse_2 = aNewDataFlow_1_4_2_1_1_2_2_1_1.INode( 'MakeFuse_2' , PyMakeFuse_2 )
162     MakeFuse_2.SetName( 'MakeFuse_2' )
163     MakeFuse_2.SetAuthor( '' )
164     MakeFuse_2.SetComment( 'Compute Node' )
165     MakeFuse_2.Coords( 1049 , 295 )
166     IMakeFuse_2shape1 = MakeFuse_2.InPort( 'shape1' , 'objref' )
167     IMakeFuse_2shape2 = MakeFuse_2.InPort( 'shape2' , 'objref' )
168     IMakeFuse_2Gate = MakeFuse_2.GetInPort( 'Gate' )
169     OMakeFuse_2shape = MakeFuse_2.OutPort( 'shape' , 'objref' )
170     OMakeFuse_2Gate = MakeFuse_2.GetOutPort( 'Gate' )
171     
172     # Creation of Links
173     LgagGateMakeBox1Gate = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OgagGate , IMakeBox1Gate )
174     
175     LgagGateMakeSphere_1Gate = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OgagGate , IMakeSphere_1Gate )
176     LgagGateMakeSphere_1Gate.AddCoord( 1 , 164 , 470 )
177     LgagGateMakeSphere_1Gate.AddCoord( 2 , 164 , 265 )
178     
179     LMakeBox1shapeMakeCopy_1shape1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeBox1shape , IMakeCopy_1shape1 )
180     
181     LMakeBox1shapeMakeCopy_2shape1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeBox1shape , IMakeCopy_2shape1 )
182     LMakeBox1shapeMakeCopy_2shape1.AddCoord( 1 , 384 , 207 )
183     
184     LMakeCopy_1shapeMakeTranslation_1shape1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeCopy_1shape , IMakeTranslation_1shape1 )
185     
186     LMakeCopy_2shapeMakeFuse_1shape2 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeCopy_2shape , IMakeFuse_1shape2 )
187     LMakeCopy_2shapeMakeFuse_1shape2.AddCoord( 1 , 674 , 207 )
188     
189     LMakeSphere_1shapeMakeFuse_2shape2 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeSphere_1shape , IMakeFuse_2shape2 )
190     
191     LMakeTranslation_1shapeMakeFuse_1shape1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeTranslation_1shape , IMakeFuse_1shape1 )
192     
193     LMakeFuse_1shapeMakeFuse_2shape1 = aNewDataFlow_1_4_2_1_1_2_2_1_1.Link( OMakeFuse_1shape , IMakeFuse_2shape1 )
194     LMakeFuse_1shapeMakeFuse_2shape1.AddCoord( 1 , 1017 , 366 )
195     LMakeFuse_1shapeMakeFuse_2shape1.AddCoord( 2 , 1017 , 187 )
196     
197     # Input datas
198     IMakeBox1x1.Input( 0 )
199     IMakeBox1y1.Input( 0 )
200     IMakeBox1z1.Input( 0 )
201     IMakeBox1x2.Input( 50 )
202     IMakeBox1y2.Input( 50 )
203     IMakeBox1z2.Input( 50 )
204     IMakeSphere_1x1.Input( 0 )
205     IMakeSphere_1y1.Input( 0 )
206     IMakeSphere_1z1.Input( 0 )
207     IMakeSphere_1radius.Input( 12 )
208     IMakeTranslation_1x1.Input( 25 )
209     IMakeTranslation_1y1.Input( 25 )
210     IMakeTranslation_1z1.Input( 25 )
211     
212     # Output Ports of the graph
213     #OMakeFuse_2shape = MakeFuse_2.GetOutPort( 'shape' )
214     return aNewDataFlow_1_4_2_1_1_2_2_1_1
215
216
217 aNewDataFlow_1_4_2_1_1_2_2_1_1 = DefaNewDataFlow_1_4_2_1_1_2_2_1_1()