Create Gauss Points presentations on a field of the imported MED file:
import os from time import sleep import salome import SALOMEDS import VISU import visu_gui # The directory containing MED files datadir = os.getenv("DATA_DIR") # Get VISU engine myVisu = visu_gui.myVisu # Import the file medFile = os.path.join(datadir,"MedFiles","pointe.med") myResult = myVisu.ImportFile(medFile) # Create gauss points for the first timestamp of 'fieldcelldoublevector' field meshName = 'maa1' fieldEntity = VISU.CELL fieldName = 'fieldcelldoublevector' # Create a Gauss Points presentation of the first type: <b>Results at Gauss Points</b> myGaussPoints1 = myVisu.GaussPointsOnField(myResult, meshName, fieldEntity, fieldName, 1) # Set range values (5-50%): myGaussPoints1.SetMinSize(0.05) myGaussPoints1.SetMaxSize(0.5) # Set OpenGL Points as a primitive type myGaussPoints1.SetPrimitiveType(VISU.GaussPoints.POINT) # Set the maximum size of points myGaussPoints1.SetClamp(32) # Create a Gauss Points presentation of the second type: <b>Gauss Points on Geometry</b> myGaussPoints2 = myVisu.GaussPointsOnField(myResult, meshName, fieldEntity, fieldName, 1) myGaussPoints2.SetIsColored(False) # Set magnification to 200% myGaussPoints2.SetMagnification(2) # Set magnification ratio myGaussPoints2.SetMagnificationIncrement(4) # Set the size of points myGaussPoints2.SetGeomSize(0.25) # Set the color of points myGaussPoints2.SetColor(SALOMEDS.Color(255, 90, 255)) # Create a Gauss Points presentation of the third type: <b>Gauss Points on Deformed Shape</b> myGaussPoints3 = myVisu.GaussPointsOnField(myResult, meshName, fieldEntity, fieldName, 1) # Apply the deformation myGaussPoints3.SetIsDeformed(True) myGaussPoints3.SetScaleFactor(0.4) # Set a geometrical sphere as the primitive type myGaussPoints3.SetPrimitiveType(VISU.GaussPoints.SPHERE) # Set sphere resolution myGaussPoints3.SetResolution(5) # Update object browser salome.sg.updateObjBrowser(1) # Display the newly created presentations one by one myViewManager = myVisu.GetViewManager() myView = myViewManager.Create3DView() prsList = [myGaussPoints1, myGaussPoints2, myGaussPoints3] for prs in prsList: myView.DisplayOnly(prs) myView.FitAll() sleep(5)
Please, see GaussPoints interface reference documentation for more details.