Back to index

salome-paravis  6.5.0
demo7.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 demo7(fname, impth):
00027     """This method demonstrates the Slice filter."""
00028 
00029     v=GetActiveView()
00030     reader = ExodusIIReader(FileName=fname)
00031     sliceFilter = Slice(reader)
00032     Show(sliceFilter)
00033     Render()
00034    
00035     camera = GetActiveCamera()
00036     camera.Elevation(30)
00037     camera.SetPosition(17, 40, -25)
00038     Render()
00039     WriteImage(filename = (impth + "sliceFilter_1.png"), view=v, Magnification=2)
00040 
00041     sliceFilter.SliceType.Normal
00042 
00043     #The origin of the slice needs to be moved to see slices in the Y-plane
00044     sliceFilter.SliceType.Origin = [2.5,5,0]
00045     sliceFilter.SliceType.Normal = [0,1,0]
00046     Render()
00047     WriteImage(filename = (impth + "sliceFilter_2.png"), view=v, Magnification=2)
00048 
00049     sliceFilter.SliceType.Normal = [0,0,1]
00050     Render()
00051     WriteImage(filename = (impth + "sliceFilter_3.png"), view=v, Magnification=2)
00052 
00053     sliceFilter.SliceType.Normal = [0,1,0]
00054     sliceFilter.SliceOffsetValues
00055     sliceFilter.SliceOffsetValues = [-4,-3.11,-2.22,-1.33,-0.44,0.44,1.33,2.22,3.11,4]
00056 
00057     Render()
00058     WriteImage(filename = (impth + "sliceFilter_4.png"), view=v, Magnification=2)
00059 
00060 testdir = os.getenv("TESTDIR")
00061 pvdata = os.getenv("PVDATA")
00062 
00063 if __name__ == "__main__":
00064  demo7(fname=pvdata+"/Data/can.ex2", impth=testdir+"/Pic/")