1 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # Author : Paul RASCLE, EDF
27 Module salome gives access to Salome ressources.
32 salome.naming_service : instance of naming Service class
34 Resolve(name) : find a CORBA object (ior) by its pathname
35 Register(name) : register a CORBA object under a pathname
36 salome.lcc : instance of lifeCycleCORBA class
38 FindOrLoadComponent(server,name) :
39 obtain an Engine (CORBA object)
40 or launch the Engine if not found,
41 with a Server name and an Engine name
44 updateObjBrowser(bool):
48 SelectedCount(): returns number of selected objects
49 getSelected(i): returns entry of selected object number i
50 getAllSelected(): returns list of entry of selected objects
51 AddIObject(Entry): select an existing Interactive object
52 RemoveIObject(Entry): remove object from selection
53 ClearIObjects(): clear selection
61 IDToObject(Entry): returns CORBA reference from entry
63 salome.myStudyName : active Study Name
64 salome.myStudyId : active Study Id
65 salome.myStudy : the active Study itself (CORBA ior)
66 methods : defined in SALOMEDS.idl
70 from salome_kernel import *
71 from salome_study import *
72 from salome_iapp import *
74 orb, lcc, naming_service, cm,sg=None,None,None,None,None
75 myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None
78 def salome_init(theStudyId=0,embedded=0):
80 Performs only once SALOME general purpose intialisation for scripts.
81 optional argument : theStudyId
82 When in embedded interpreter inside IAPP, theStudyId is not used
83 When used without GUI (external interpreter)
84 0 : create a new study (default).
85 n (>0) : try connection to study with Id = n, or create a new one
87 If study creation, its Id may be different from theStudyId !
89 orb reference to CORBA
90 lcc a LifeCycleCorba instance
91 naming_service a naming service instance
92 cm reference to the container manager
93 sg access to SALOME GUI (when linked with IAPP GUI)
94 myStudyManager the study manager
95 myStudyId active study identifier
96 myStudy active study itself (CORBA reference)
97 myStudyName active study name
100 global orb, lcc, naming_service, cm
102 global myStudyManager, myStudyId, myStudy, myStudyName
107 sg = salome_iapp_init(embedded)
108 orb, lcc, naming_service, cm = salome_kernel_init()
109 myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
112 except RuntimeError, inst:
113 # wait a little to avoid trace mix
117 print "salome.salome_init():", x
119 ============================================
120 May be there is no running SALOME session
121 salome.salome_init() is intented to be used
122 within an already running session
123 ============================================
127 #to expose all objects to pydoc