Salome HOME
Merge remote branch 'origin/V7_dev'
[modules/paravis.git] / test / VisuPrs / 3D_viewer / A3.py
index 69fbd244b700dcc7d157c223c9332eeac130d291..2daf15a219343631aba3e2612af3afd4de8ed675 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2010-2013  CEA/DEN, EDF R&D
+# Copyright (C) 2010-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -24,19 +24,15 @@ from paravistest import *
 from presentations import *
 from pvsimple import *
 import sys
-import paravis
 import time
 
 # Directory for saving snapshots
-picturedir = get_picture_dir(sys.argv[1], "3D_viewer/A3")
+picturedir = get_picture_dir("3D_viewer/A3")
 
 # Add path separator to the end of picture path if necessery
 if not picturedir.endswith(os.sep):
     picturedir += os.sep
 
-#import file
-my_paravis = paravis.myParavis
-
 # Get view
 my_view = GetRenderView()
 reset_view(my_view)
@@ -47,7 +43,18 @@ print " --------------------------------- "
 print "file ", file_name
 print " --------------------------------- "
 
-my_paravis.ImportFile(file_name)
+OpenDataFile(file_name)
+#reader = OpenDataFile(file_name)
+#reader = MEDReader(FileName=file_name)
+#keys = reader.GetProperty("FieldsTreeInfo")[::2]
+#reader.AllArrays = [keys[0]]
+#SetActiveSource(reader)
+
+#reader.UpdatePipelineInformation()
+#from paraview import servermanager
+#res = servermanager.Fetch(reader,0)
+#print res
+
 proxy = GetActiveSource()
 if proxy is None:
     raise RuntimeError("Error: can't import file.")
@@ -56,20 +63,21 @@ else:
 
 represents = [RepresentationType.POINTS, RepresentationType.WIREFRAME,\
 RepresentationType.SURFACE, RepresentationType.VOLUME]
+
 shrinks = [0, 1]
-shadings = [0, 1]
+shadings = ["Flat", "Gouraud"]
 opacities = [1.0, 0.5, 0.0]
 linewidths = [1.0, 3.0, 10.0]
 compare_prec = 0.00001
 
-field_name = 'vectoriel_field'
+field_name = 'vectoriel field'
 
 print "\nCreating stream_lines......."
 stream_lines = StreamLinesOnField(proxy, EntityType.CELL,
-field_name, 1, is_colored=True)
+                                  field_name, 1, is_colored=True)
 stream_tracer = stream_lines.Input
 print "stream_tracer:", stream_tracer
-stream_tracer.Input = None
+#stream_tracer.Input = None
 stream_tracer.InitialStepLength = 0.00940275
 stream_tracer.MaximumStreamlineLength = 140.373
 stream_tracer.MaximumStepLength = 0.5319
@@ -97,7 +105,7 @@ for reprCode in represents:
 
         for sha in shadings:
             setShaded(my_view, sha)
-            call_and_check(stream_lines, "Shading", sha, 1)
+            call_and_check(stream_lines, "Interpolation", sha, 1)
             Render(my_view)
             time.sleep(1)