Back to index

salome-paravis  6.5.0
demo11.py
Go to the documentation of this file.
00001 # Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 #
00003 # This library is free software; you can redistribute it and/or
00004 # modify it under the terms of the GNU Lesser General Public
00005 # License as published by the Free Software Foundation; either
00006 # version 2.1 of the License.
00007 #
00008 # This library is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 # Lesser General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU Lesser General Public
00014 # License along with this library; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 #
00017 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 #
00019 
00020 
00021 if not ('servermanager' in dir()):
00022   from pvsimple import *
00023 
00024 import os
00025 
00026 def demo11(fname, impth):
00027     """This method demonstrates the Contour filter."""
00028 
00029     reader = ExodusIIReader(FileName=fname)
00030     v=GetActiveView()
00031     clipFilter = Clip(reader)
00032     clipFilter.ClipType = 'Scalar'
00033  
00034     clipFilter.Scalars = 'Temp'
00035     clipFilter.Value = 400
00036     Show(clipFilter)
00037     camera = GetActiveCamera()
00038     camera.Elevation(-75)
00039     Render()
00040     WriteImage(filename = (impth + "clipFilter_1.png"), view=v, Magnification=2)
00041 
00042     clipFilter2 = Clip(clipFilter)
00043     Show(clipFilter2)
00044     Hide(clipFilter)
00045     camera.SetPosition(-39, 0, 1.46)
00046     camera.Roll(90)
00047     WriteImage(filename = (impth + "clipFilter_2.png"), view=v, Magnification=2)
00048 
00049     dp1 = GetDisplayProperties(reader)
00050     dp2 = GetDisplayProperties(clipFilter2)
00051     clipFilter2.PointData[:]
00052     ##[Array: Temp, Array: V, Array: Pres, Array: AsH3, Array: GaMe3, Array: CH4, Array: H2]
00053 
00054     temp = clipFilter2.PointData[0]
00055     temp.GetRange()
00056     ##(399.99999999999994, 913.1500244140625)
00057 
00058     dp2.LookupTable = MakeBlueToRedLT(400,913.15)
00059     dp2.ColorAttributeType = 'POINT_DATA'
00060     dp2.ColorArrayName = 'Temp'
00061     Hide(reader)
00062     Render()
00063     WriteImage(filename = (impth + "clipFilter_3.png"), view=v, Magnification=2)
00064 
00065     dp1.Representation = 'Volume'
00066     temp.GetRange()
00067     ##(399.99999999999994, 913.1500244140625)
00068     dp1.LookupTable = dp2.LookupTable
00069     dp1.ColorAttributeType = 'POINT_DATA'
00070     dp1.ColorArrayName = 'Temp'
00071     Show(reader)
00072     Render()
00073     WriteImage(filename = (impth + "clipFilter_4.png"), view=v, Magnification=2)
00074 
00075 testdir = os.getenv("TESTDIR")
00076 pvdata = os.getenv("PVDATA")
00077 
00078 if __name__ == "__main__":
00079  demo11(fname=pvdata+"/Data/disk_out_ref.ex2", impth=testdir+"/Pic/")