myVisu = visu_gui.myVisu
medFile = "pointe.med"
-absMedFile = medFile
-medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
print medFile
studyCurrent = salome.myStudyName
try:
if os.access(medFile, os.R_OK) :
- print "Reading the .med file ",medFile," and pushing corba objects in the SALOME study"
- med_comp.readStructFileWithFieldType(medFile,studyCurrent)
- med_obj = visu_gui.visu.getMedObjectFromStudy(absMedFile)
- print "med_obj - ", med_obj
-
-
- nbOfMeshes = med_obj.getNumberOfMeshes()
- print "in this med file there is(are) ",nbOfMeshes," mesh(es),"
- meshNames = med_obj.getMeshNames()
- meshName = meshNames[0]
-
- supportName = "SupportOnAll_MED_NOEUD"
-
- nbOfFields = med_obj.getNumberOfFields()
- print "and ",nbOfFields," field(s)."
- fieldNames = med_obj.getFieldNames()
- fieldName = fieldNames[1]
- nbOfIt = med_obj.getFieldNumberOfIteration(fieldName)
- print "the field ",fieldName," has ",nbOfIt," iteration(s)"
- dtitsfield = med_obj.getFieldIterations(fieldName)
- dtitfield = dtitsfield[0:2]
- dt = dtitfield[0]
- it = dtitfield[1]
-
-## myField = visu_gui.visu.getFieldObjectFromStudy(2,1)
- # the first iteration of the second field
- myField = visu_gui.visu.getFieldObjectFromStudy(dt, it, fieldName,
- supportName,
- meshName)
- aMeshName = "FILED_DOUBLE_MESH"
- anEntity = VISU.NODE
- aTimeStampId = 0
+ if os.access(medFile, os.W_OK) :
+ med_comp.readStructFileWithFieldType(medFile,studyCurrent)
+ med_obj = visu_gui.visu.getMedObjectFromStudy()
+ print "med_obj - ", med_obj
+
+ myField = visu_gui.visu.getFieldObjectFromStudy(2,1)
+ aMeshName = "FILED_DOUBLE_MESH"
+ anEntity = VISU.NODE
+ aTimeStampId = 0
- myResult1 = myVisu.ImportMedField(myField)
- aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
+ myResult1 = myVisu.ImportMedField(myField)
+ aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity);
- aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
- if(myField.getNumberOfComponents() > 1) :
- aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
+ aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
+ if(myField.getNumberOfComponents() > 1) :
+ aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId)
- myResult2 = myVisu.ImportFile(medFile)
- aMeshName = "maa1"
- anEntity = VISU.NODE
- aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity)
+ myResult2 = myVisu.ImportFile(medFile)
+ aMeshName = "maa1"
+ anEntity = VISU.NODE
+ aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity)
- aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
- if(myField.getNumberOfComponents() > 1) :
- aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
+ aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
+ if(myField.getNumberOfComponents() > 1) :
+ aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId)
- sg.updateObjBrowser(0)
+ sg.updateObjBrowser(0)
+ else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file";
else : print "We have no permission to read medFile, it will not be opened";
except:
if sys.exc_type == SALOME.SALOME_Exception :