Back to index

salome-med  6.5.0
test_medclient.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 import salome
00025 import SALOME_TESTMEDCLIENT
00026 import SALOME_MED
00027 
00028 def getMedObjectFromStudy():
00029     mySO = salome.myStudy.FindObject("Objet MED")
00030     Builder = salome.myStudy.NewBuilder()
00031     anAttr = Builder.FindOrCreateAttribute(mySO, "AttributeIOR")
00032     obj = salome.orb.string_to_object(anAttr.Value())
00033     myObj = obj._narrow(SALOME_MED.MED)
00034     return myObj
00035 
00036 #Truc1,Truc2 are Containers launched with SALOME_Container exe.
00037 
00038 med_comp = salome.lcc.FindOrLoadComponent("Truc1", "MED")
00039 my_comp = salome.lcc.FindOrLoadComponent("Truc2","TESTMEDCLIENT")
00040 studyCurrent = salome.myStudyName
00041 
00042 ## First test
00043 
00044 ##med_obj = med_comp.readStructFile("cube_tetra4_12.med",studyCurrent)
00045 ##my_comp.go2(med_obj)
00046 
00047 ## Second test
00048 
00049 med_obj = med_comp.readStructFile("cube_hexa8_quad4.med",studyCurrent)
00050 my_comp.go(med_obj)