1 # Copyright (C) 2010-2012 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 import SALOME_Session_idl
29 import SALOME_ModuleCatalog
30 from omniORB import CORBA
31 from time import sleep
35 myNamingService = None
36 myLifeCycleCORBA = None
37 myNamingService = None
38 myLocalStudyManager = None
44 ## Initialization of paravis server
45 def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, theStudy, theDelay) :
46 global myORB, myNamingService, myLifeCycleCORBA, myLocalStudyManager, myLocalStudy
47 global mySession, myDelay
50 myNamingService = theNamingService
51 myLifeCycleCORBA = theLifeCycleCORBA
52 myLocalStudyManager = theStudyManager
53 while mySession == None:
54 mySession = myNamingService.Resolve("/Kernel/Session")
55 mySession = mySession._narrow(SALOME.Session)
56 mySession.GetInterface()
59 myLocalParavis = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "PARAVIS")
60 myLocalStudy = theStudy
61 myLocalParavis.SetCurrentStudy(myLocalStudy)
62 myLocalParavis.ActivateModule()
66 def ImportFile(theFileName):
67 "Import a file of any format supported by ParaView"
68 myParavis.ImportFile(theFileName)
71 def createFunction(theName):
72 "Create function - constructor of Paravis object"
74 return myParavis.CreateClass(theName)
78 def createConstructors():
79 "Create constructor functions according to list of extracted classes"
81 aClassNames = myParavis.GetClassesList();
82 for aName in aClassNames:
83 g[aName] = createFunction(aName)
85 ## Initialize of a PARAVIS interface
86 myParavis = Initialize(orb, naming_service,lcc,myStudyManager,myStudy, 2)
88 ## Initialize constructor functions
91 ## Initialize Paravis static objects
92 vtkSMObject = vtkSMObject()
93 vtkProcessModule = vtkProcessModule()
94 vtkPVPythonModule = vtkPVPythonModule()
95 vtkSMProxyManager = vtkSMProxyManager()