Back to index

salome-paravis  6.5.0
demo6.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 demo6(fname, impth):
00027     """This method demonstrates the Clip filter."""
00028 
00029     reader = ExodusIIReader(FileName=fname)
00030     v = CreateRenderView()
00031     repr = Show(reader, view=v)
00032     Render()
00033     v.StillRender()
00034     v.ResetCamera()
00035     clipFilter = Clip(reader)
00036     Hide(reader)
00037     Show(clipFilter)
00038     Render()
00039 
00040     #get camera
00041     camera = GetActiveCamera()
00042     camera.GetPosition()
00043 
00044     #figure out where you are
00045     camera.SetPosition(4.156,4.0,-36.29)
00046     camera.Elevation(30)
00047     camera.SetPosition(4.15603, 30, -35)
00048     Render()
00049     clipFilter.UseValueAsOffset = 1
00050     clipFilter.Value = 5
00051     Render()
00052     WriteImage(filename = (impth + "clipFilter_1.png"), view=v, Magnification=2)
00053 
00054     clipFilter.ClipType.Normal
00055     clipFilter.ClipType.Origin
00056 
00057     #reset the offset value of the clip to 0
00058     clipFilter.Value = 0
00059     clipFilter.ClipType.Normal = [0, 0, 1]
00060     Render()
00061     WriteImage(filename = (impth + "clipFilter_2.png"), view=v, Magnification=2)
00062 
00063     clipFilter.Value = -3
00064     Render()
00065     WriteImage(filename = (impth + "clipFilter_3.png"), view=v, Magnification=2)
00066 
00067     clipFilter.InsideOut = 1
00068     Render()
00069     WriteImage(filename = (impth + "clipFilter_4.png"), view=v, Magnification=2)
00070 
00071 testdir = os.getenv("TESTDIR")
00072 pvdata = os.getenv("PVDATA")
00073 
00074 if __name__ == "__main__":
00075  demo6(fname=pvdata+"/Data/can.ex2", impth=testdir+"/Pic/")