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
23 # Author : Paul RASCLE, EDF
28 Module salome gives access to Salome ressources.
33 - salome.naming_service : instance of naming Service class
35 - Resolve(name) : find a CORBA object (ior) by its pathname
36 - Register(name) : register a CORBA object under a pathname
38 - salome.lcc : instance of lifeCycleCORBA class
40 - FindOrLoadComponent(server,name) :
41 obtain an Engine (CORBA object)
42 or launch the Engine if not found,
43 with a Server name and an Engine name
45 - salome.sg : salome object to communicate with the graphical user interface (if any)
47 - updateObjBrowser(bool):
49 - getActiveStudyName():
51 - SelectedCount(): returns number of selected objects
52 - getSelected(i): returns entry of selected object number i
53 - getAllSelected(): returns list of entry of selected objects
54 - AddIObject(Entry): select an existing Interactive object
55 - RemoveIObject(Entry): remove object from selection
56 - ClearIObjects(): clear selection
64 - IDToObject(Entry): returns CORBA reference from entry
66 - salome.myStudyName : active Study Name
67 - salome.myStudyId : active Study Id
68 - salome.myStudy : the active Study itself (CORBA ior)
69 - methods : defined in SALOMEDS.idl
73 # Module salome gives access to Salome ressources.
75 # \param salome.orb : CORBA orb object
76 # \param salome.naming_service : instance of naming Service class (SALOME_NamingServicePy::SALOME_NamingServicePy_i)
77 # \param salome.lcc : instance of lifeCycleCORBA class (SALOME_LifeCycleCORBA)
78 # \param salome.sg : Salome object to communicate with the graphical user interface, if running (see interface in salome_iapp::SalomeOutsideGUI)
79 # \param salome.myStudyName : active Study Name
80 # \param salome.myStudyId : active Study Id
81 # \param salome.myStudy : the active Study (interface SALOMEDS::Study)
84 from salome_kernel import *
85 from salome_study import *
86 from salome_iapp import *
88 orb, lcc, naming_service, cm,sg=None,None,None,None,None
89 myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None
92 def salome_init(theStudyId=0,embedded=0):
94 Performs only once SALOME general purpose intialisation for scripts.
95 optional argument : theStudyId
96 When in embedded interpreter inside IAPP, theStudyId is not used
97 When used without GUI (external interpreter)
98 0 : create a new study (default).
99 n (>0) : try connection to study with Id = n, or create a new one
101 If study creation, its Id may be different from theStudyId !
103 orb reference to CORBA
104 lcc a LifeCycleCorba instance
105 naming_service a naming service instance
106 cm reference to the container manager
107 sg access to SALOME GUI (when linked with IAPP GUI)
108 myStudyManager the study manager
109 myStudyId active study identifier
110 myStudy active study itself (CORBA reference)
111 myStudyName active study name
113 global salome_initial
114 global orb, lcc, naming_service, cm
116 global myStudyManager, myStudyId, myStudy, myStudyName
121 sg = salome_iapp_init(embedded)
122 orb, lcc, naming_service, cm = salome_kernel_init()
123 myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
126 except RuntimeError, inst:
127 # wait a little to avoid trace mix
131 print "salome.salome_init():", x
133 ============================================
134 May be there is no running SALOME session
135 salome.salome_init() is intented to be used
136 within an already running session
137 ============================================
141 #to expose all objects to pydoc