Salome HOME
All plugins except TableReader ported. Legacy plugins removed.
[modules/paravis.git] / src / PV_SWIG / paravis.py
1 # Copyright (C) 2010-2014  CEA/DEN, EDF R&D
2 #
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, or (at your option) any later version.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 #  File   : paravis.py
20 #  Module : PARAVIS
21 #
22
23 import os, new
24
25 import PARAVIS
26 import SALOME
27 import SALOME_Session_idl
28 import SALOMEDS
29 import SALOME_ModuleCatalog
30 from omniORB import CORBA
31 from time import sleep
32 from salome import *
33
34 myORB = None
35 myNamingService = None
36 myLifeCycleCORBA = None
37 myNamingService = None
38 myLocalStudyManager = None
39 myLocalStudy = None
40 myLocalParavis = None
41 myDelay = None
42 mySession = None
43
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
48     myDelay = theDelay
49     myORB = theORB
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()
57     myDelay = theDelay
58     sleep(myDelay)
59     myLocalParavis = myLifeCycleCORBA.FindOrLoadComponent("FactoryServer", "PARAVIS")
60     myLocalStudy = theStudy
61     myLocalParavis.SetCurrentStudy(myLocalStudy)
62     myLocalParavis.ActivateModule()
63     return myLocalParavis
64
65
66 def ImportFile(theFileName):
67     "Import a file of any format supported by ParaView"
68     myParavis.ImportFile(theFileName)
69
70 ## Initialize PARAVIS interface  
71 myParavis = Initialize(orb, naming_service,lcc,myStudyManager,myStudy, 2)
72
73 ## Initialize Paravis static objects
74 #vtkSMObject = vtkSMObject()
75 #vtkProcessModule = vtkProcessModule()
76 #vtkPVPythonModule = vtkPVPythonModule()
77 #vtkSMProxyManager = vtkSMProxyManager()
78