1 # Copyright (C) 2010-2016 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
19 if not ('servermanager' in dir()):
20 from pvsimple import *
25 """Simple demo that create the following pipeline
31 # Create a sphere of radius = 0.5, theta res. = 32
32 # This object becomes the active source.
33 ss = Sphere(Radius=0.5, ThetaResolution=32, PhiResolution=8)
35 # The view and representation
38 v = CreateRenderView()
39 v.CameraPosition = [-3, -3, -3]
40 v.CameraViewUp = [0, 0, 1]
43 # Apply the shrink filter. The Input property is optional. If Input
44 # is not specified, the filter is applied to the active source.
45 shr = Shrink(Input=ss)
47 # Create a cone source.
50 # Append cone and shrink
51 app = AppendDatasets()
54 # Show the output of the append filter. The argument is optional
55 # as the app filter is now the active object.
57 WriteImage(filename = (impth + "demo1_1.png"), view=v, Magnification=2)
59 PointData = app.GetDataInformation().GetNumberOfPoints()
60 CellData = app.GetDataInformation().GetNumberOfCells()
61 print PointData, " Points"
62 print CellData, " Cells"
64 # Render the default view.
68 scriptdir = inspect.getframeinfo(inspect.currentframe())[0]
69 testdir = os.path.dirname( os.path.abspath(scriptdir) )
72 if __name__ == "__main__":
73 demo1(impth =testdir+"/Pic/")