1 # Copyright (C) 2010-2014 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 if not ('servermanager' in dir()):
22 from pvsimple import *
26 def demo7(fname, impth):
27 """This method demonstrates the Slice filter."""
30 reader = ExodusIIReader(FileName=fname)
31 sliceFilter = Slice(reader)
35 camera = GetActiveCamera()
37 camera.SetPosition(17, 40, -25)
39 WriteImage(filename = (impth + "sliceFilter_1.png"), view=v, Magnification=2)
41 sliceFilter.SliceType.Normal
43 #The origin of the slice needs to be moved to see slices in the Y-plane
44 sliceFilter.SliceType.Origin = [2.5,5,0]
45 sliceFilter.SliceType.Normal = [0,1,0]
47 WriteImage(filename = (impth + "sliceFilter_2.png"), view=v, Magnification=2)
49 sliceFilter.SliceType.Normal = [0,0,1]
51 WriteImage(filename = (impth + "sliceFilter_3.png"), view=v, Magnification=2)
53 sliceFilter.SliceType.Normal = [0,1,0]
54 sliceFilter.SliceOffsetValues
55 sliceFilter.SliceOffsetValues = [-4,-3.11,-2.22,-1.33,-0.44,0.44,1.33,2.22,3.11,4]
58 WriteImage(filename = (impth + "sliceFilter_4.png"), view=v, Magnification=2)
60 testdir = os.getenv("TESTDIR")
61 pvdata = os.getenv("PVDATA")
63 if __name__ == "__main__":
64 demo7(fname=pvdata+"/Data/can.ex2", impth=testdir+"/Pic/")