-# Copyright (C) 2010-2014 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
from paravistest import datadir, delete_with_inputs
from presentations import *
-import paravis
from pvsimple import *
+from paravistest import save_trace
+from paraview import smtrace
-my_paravis = paravis.myParavis
+GetActiveViewOrCreate('RenderView')
-settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Scale": 0.333, "ColorArray": "", "ColorComponents": [0.111, 0.222, 0.333], "LineWidth": 2, "GlyphType": 'Cone', "GlyphPos": [-0.5, 0.0, 0.0]}
+config = smtrace.start_trace()
+config.SetFullyTraceSupplementalProxies(True)
+config.SetPropertiesToTraceOnCreate(config.RECORD_ALL_PROPERTIES)
+
+
+settings = {"Offset": [0.0001, 0.0002, 0], "ScalarMode": ("Component", 2), "Position": [0.1, 0.2], "Size": [0.15, 0.25], "Discretize": 1, "NbColors": 44, "NbLabels": 22, "Title": "My presentation", "UseLogScale": 1, "Orientation": 'Horizontal', "Scale": 0.333, "ColorComponents": [0.111, 0.222, 0.333], "LineWidth": 2, "GlyphType": 'Cone', "GlyphPos": [-0.5, 0.0, 0.0]}
# 1. TimeStamps.med import
file_path = datadir + "TimeStamps.med"
-my_paravis.ImportFile(file_path)
+OpenDataFile(file_path)
med_reader = GetActiveSource()
if med_reader is None :
raise RuntimeError, "TimeStamps.med wasn't imported..."
# 2. Vectors creation
med_field = "vitesse"
-vectors = VectorsOnField(med_reader, EntityType.NODE, med_field, 1)
+vectors = VectorsOnField(med_reader, EntityType.NODE, med_field, 1,is_colored=True)
+vectors.Visibility = 1
+vectors.SetScalarBarVisibility(GetActiveView(),1)
# apply settings
vectors.Position = settings["Offset"]
vectors.LookupTable.NumberOfTableValues = settings["NbColors"]
vectors.LookupTable.UseLogScale = settings["UseLogScale"]
-vectors.Input.SetScaleFactor = settings["Scale"]
-vectors.ColorArrayName = ''
+vectors.Input.ScaleFactor = settings["Scale"]
vectors.AmbientColor = settings["ColorComponents"]
vectors.LineWidth = settings["LineWidth"]
cone_glyth_type = type(vectors.Input.GlyphType)
# 3. Dump Study
+text = smtrace.stop_trace()
path_to_save = os.path.join(os.getenv("HOME"), "Vectors.py")
-SaveTrace( path_to_save )
+save_trace( path_to_save, text )
# 4. Delete the created objects, recreate the view
delete_with_inputs(vectors)
execfile(path_to_save)
# 6. Checking of the settings done before dump
-recreated_bar = view.Representations[0]
-recreated_vectors = view.Representations[1]
+recreated_bar = view.Representations[1]
+recreated_vectors = view.Representations[0]
errors = 0
tolerance = 1e-05
errors += 1
# Scale factor
-scale = recreated_vectors.Input.SetScaleFactor
+scale = recreated_vectors.Input.ScaleFactor
if abs(scale - settings["Scale"]) > tolerance:
print "ERROR!!! Scale of presentation is incorrect: ", scale, " instead of ", settings["Scale"]
errors += 1
# Color array name
-array_name = recreated_vectors.ColorArrayName
-if array_name != settings["ColorArray"]:
- print "ERROR!!! Color array name of presentation is incorrect: ", array_name, " instead of ", settings["arrayName"]
+array_name = recreated_vectors.ColorArrayName[1]
+if array_name != med_field:
+ print "ERROR!!! Color array name of presentation is incorrect: ", array_name, " instead of ", med_field
errors += 1
# Color