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
28 from omniORB import CORBA
29 from LifeCycleCORBA import *
30 from libSALOME_Swig import *
32 from SALOME_NamingServicePy import *
34 #--------------------------------------------------------------------------
36 def DumpComponent(Study, SO, offset):
37 it = Study.NewChildIterator(SO)
38 Builder = Study.NewBuilder()
42 anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName")
43 AtName = anAttr._narrow(SALOMEDS.AttributeName)
44 t_name = AtName.Value()
51 print a + ">" + CSO.GetID() + " " + t_name[1]
52 t_RefSO = CSO.ReferencedObject()
60 print a + ">" + RefSO.GetID()
61 DumpComponent(Study, CSO, offset+2)
63 #--------------------------------------------------------------------------
66 itcomp = Study.NewComponentIterator()
70 name = SC.ComponentDataType()
71 print "-> ComponentDataType is " + name
72 DumpComponent(Study, SC, 1)
75 #--------------------------------------------------------------------------
78 orb = CORBA.ORB_init([''], CORBA.ORB_ID)
80 # create an LifeCycleCORBA instance
81 lcc = LifeCycleCORBA(orb)
83 # create an SALOMEGUI_Swig instance
86 #create an naming service instance
87 naming_service = SALOME_NamingServicePy_i(orb)
89 # get active study name and id
90 myStudyName = sg.getActiveStudyName()
93 myStudyId = sg.getActiveStudyId()
96 # get Study Manager reference
97 obj = naming_service.Resolve('myStudyManager')
98 myStudyManager = obj._narrow(SALOMEDS.StudyManager)
101 myStudy = myStudyManager.GetStudyByName(myStudyName)