Back to index

salome-paravis  6.5.0
demo9.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 demo9(fname, impth):
00027     """This method demonstrates the Threshold filter."""
00028 
00029     reader = ExodusIIReader(FileName=fname)
00030     v=GetActiveView()
00031     Show(reader, view=v)
00032     dp1 = GetDisplayProperties(reader)
00033     dp1.Representation = 'Wireframe'
00034     camera = GetActiveCamera()
00035     camera.Elevation(-60)
00036     thresholdFilter = Threshold(reader)
00037     thresholdFilter.Scalars
00038     ##['POINTS', 'GlobalNodeId']
00039 
00040     thresholdFilter.Scalars = 'Temp'
00041     Show(thresholdFilter)
00042     thresholdFilter.ThresholdRange
00043     ##[0.0, 0.0]
00044     thresholdFilter.ThresholdRange = [398.55,913.15]
00045     Render()
00046     WriteImage(filename = (impth + "thresholdFilter_1.png"), view=v, Magnification=2)
00047 
00048     dp2 = GetDisplayProperties(thresholdFilter)
00049     thresholdFilter.PointData[:]
00050     ##[Array: GlobalNodeId, Array: PedigreeNodeId, Array: Temp, Array: V, Array: Pres, Array: AsH3, Array: GaMe3, Array: CH4, Array: H2]
00051 
00052     temp = thresholdFilter.PointData[2]
00053     temp.GetRange()
00054     ##(400.46258544921875, 846.694091796875)
00055 
00056     dp2.LookupTable = MakeBlueToRedLT(400.4625,846.6909)
00057     dp2.ColorAttributeType = 'POINT_DATA'
00058     dp2.ColorArrayName = 'Temp'
00059     Render()
00060     WriteImage(filename = (impth + "thresholdFilter_2.png"), view=v, Magnification=2)
00061     
00062     #Set the lower threshold to 500
00063     thresholdFilter.ThresholdRange[0] = 500
00064     Render()
00065     WriteImage(filename = (impth + "thresholdFilter_3.png"), view=v, Magnification=2)
00066     
00067     dp1.LookupTable = MakeBlueToRedLT(400.462, 84609)
00068     dp1.ColorAttributeType = 'POINT_DATA'
00069     dp1.ColorArrayName = 'Temp'
00070     Render()
00071     WriteImage(filename = (impth + "thresholdFilter_4.png"), view=v, Magnification=2)
00072 
00073 testdir = os.getenv("TESTDIR")
00074 pvdata = os.getenv("PVDATA")
00075 
00076 if __name__ == "__main__":
00077  demo9(fname=pvdata+"/Data/disk_out_ref.ex2", impth=testdir+"/Pic/")