1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # VISU VISU_SWIG : binding of C++ implementation and Python
31 import SALOME_Session_idl
33 import SALOME_ModuleCatalog
34 from omniORB import CORBA
35 from time import sleep
39 myNamingService = None
40 myLifeCycleCORBA = None
41 myNamingService = None
42 myLocalStudyManager = None
48 ## Initialization of paravis server
49 def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, theStudy, theDelay) :
50 global myORB, myNamingService, myLifeCycleCORBA, myLocalStudyManager, myLocalStudy
51 global mySession, myDelay
54 myNamingService = theNamingService
55 myLifeCycleCORBA = theLifeCycleCORBA
56 myLocalStudyManager = theStudyManager
57 while mySession == None:
58 mySession = myNamingService.Resolve("/Kernel/Session")
59 mySession = mySession._narrow(SALOME.Session)
60 mySession.GetInterface()
63 myLocalParavis = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "PARAVIS")
64 myLocalStudy = theStudy
65 myLocalParavis.ActivateModule()
69 def ImportFile(theFileName):
70 "Import a file of any format supported by ParaView"
71 myParavis.ImportFile(theFileName)
74 def createFunction(theName):
75 "Create function - constructor of Paravis object"
77 return myParavis.CreateClass(theName)
81 def createConstructors():
82 "Create constructor functions according to list of extracted classes"
84 aClassNames = myParavis.GetClassesList();
85 for aName in aClassNames:
86 g[aName] = createFunction(aName)
88 ## Initialize of a PARAVIS interface
89 myParavis = Initialize(orb, naming_service,lcc,myStudyManager,myStudy, 2)
91 ## Initialize constructor functions
94 ## Initialize Paravis static objects
95 vtkSMObject = vtkSMObject()
96 vtkProcessModule = vtkProcessModule()
97 vtkPVPythonModule = vtkPVPythonModule()
98 vtkSMProxyManager = vtkSMProxyManager()