1 # VISU VISU_SWIG : binding of C++ implementation and Python
3 # Copyright (C) 2003 CEA/DEN, EDF R&D
7 # File : visu_prs_exam.py
18 from libSALOME_Swig import *
22 myVisu = visu_gui.myVisu
24 medFile = "pointe.med"
25 medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile
28 studyCurrent = salome.myStudyName
30 med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
31 #myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "Visu")
34 if os.access(medFile, os.R_OK) :
35 if os.access(medFile, os.W_OK) :
36 med_comp.readStructFileWithFieldType(medFile,studyCurrent)
37 med_obj = visu_gui.visu.getMedObjectFromStudy()
38 print "med_obj - ", med_obj
40 myField = visu_gui.visu.getFieldObjectFromStudy(2,1)
41 aMeshName = "FILED_DOUBLE_MESH"
45 myResult1 = myVisu.ImportMedField(myField)
46 aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
48 aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
49 if(myField.getNumberOfComponents() > 1) :
50 aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
52 myResult2 = myVisu.ImportFile(medFile)
55 aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity)
57 aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
58 if(myField.getNumberOfComponents() > 1) :
59 aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
61 sg.updateObjBrowser(0)
62 else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
63 else : print "We have no permission to read medFile, it will not be opened";
65 if sys.exc_type == SALOME.SALOME_Exception :
66 print "There is no permission to read " + medFile
70 print sys.exc_traceback