Create Deformed Shape and Scalar Map presentation on the field of the imported MED file:
import os import salome import VISU import visu_gui # The directory containing MED files datadir = os.getenv("DATA_DIR") # Get VISU engine myVisu = visu_gui.myVisu # Import a MED file medFile = os.path.join(datadir,"MedFiles","fra.med") myResult = myVisu.ImportFile(medFile) # Create a deformed shape and a scalar map for the first timestamp of 'VITESSE' field meshName = 'LE VOLUME' fieldEntity = VISU.NODE fieldName = 'VITESSE' myDefShapeScalarMap = myVisu.DeformedShapeAndScalarMapOnField(myResult, meshName, fieldEntity, fieldName, 1) # Set the scale myDefShapeScalarMap.SetScale(0.25) # Set 'TAUX_DE_VIDE' as a scalar field, use the first timestamp fieldName = 'TAUX_DE_VIDE' myDefShapeScalarMap.SetScalarField(VISU.NODE, fieldName, 1) # Update the object browser salome.sg.updateObjBrowser(1) # Display the newly created presentation myViewManager = myVisu.GetViewManager() myView = myViewManager.Create3DView() myView.DisplayOnly(myDefShapeScalarMap) myView.FitAll()
Please, see DeformedShapeAndScalarMap interface reference documentation for more details.