lookup_table.LockScalarRange = 1
else:
raise RuntimeError("Object %s has no 'LockDataRange' or 'LockScalarRange' attribute!"%(lookup_table))
-
+
lookup_table.RGBPoints = [data_range[0], 0, 0, 1, data_range[1], 1, 0, 0]
# Set properties
if (scalar_range is None):
scalar_range = get_data_range(proxy, entity,
field_name, cut_off=True)
-
+
# Get contour values for the range
surfaces = get_contours(scalar_range, nb_surfaces)
# Show and dump the presentation into a graphics file
process_prs_for_test(prs, view, pic_name)
return
+
+
+def delete_pv_object(obj):
+ # There is a bug when repeating CreateRenderView/Delete calls
+ # Here is a workaround proposed by KW (#10744)
+ import gc
+ del obj
+ gc.collect()
# Split
a_view_r = CreateRenderView()
-Delete(a_view_r)
+delete_pv_object(a_view_r)
# Split
a_view_l = CreateRenderView()
-Delete(a_view_l)
+delete_pv_object(a_view_l)
# Split
a_view_t = CreateRenderView()
-Delete(a_view_t)
+delete_pv_object(a_view_t)
# Split
a_view_b = CreateRenderView()
sleep(DELAY)
# Destroy the view
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create view and set background
# Destroy the view
print "Destroy the view with Scalar Map"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create another view for cut planes
# Destroy the view
print "Destroy the view with Cut Planes"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create one more view for isosurfaces
# Destroy the view
print "Destroy the view with Iso Surfaces"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create one more view for cut lines
# Destroy two views
#print "Destroy two views: with Cut Lines and the curves"
-#pvsimple.Delete(view)
-#pvsimple.Delete(xy_view)
+#delete_pv_object(view)
+#delete_pv_object(xy_view)
# Create one more view for animation
view = pvsimple.CreateRenderView()
# Display curves
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_view.ChartTitle = 'Very useful data'
xy_view.BottomAxisTitle = '[ Wt ]'
# Display curve
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_rep = pvsimple.Show(sinus_csv)
# This case corresponds to: /visu/SWIG_scripts/A9 case
# Import MED file; create Scalar Map, Cut Planes, Cut Lines,
# Cut Segment, Iso Surfaces, Animation; display curves.
-
+
import math
import random
from time import sleep
sleep(DELAY)
# Destroy the view
-pvs.Delete(view)
+delete_pv_object(view)
# Create view and set background
sleep(DELAY)
# Destroy the view
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create view and set background
# Destroy the view
print "Destroy the view with Scalar Map"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create another view for cut planes
# Destroy the view
print "Destroy the view with Cut Planes"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create one more view for isosurfaces
# Destroy the view
print "Destroy the view with Iso Surfaces"
-pvsimple.Delete(view)
+delete_pv_object(view)
# Create one more view for cut lines
# Destroy two views
#print "Destroy two views: with Cut Lines and the curves"
-#pvsimple.Delete(view)
-#pvsimple.Delete(xy_view)
+#delete_pv_object(view)
+#delete_pv_object(xy_view)
# Create one more view for cut segment
sleep(DELAY)
-pvsimple.Delete(view1)
-print "pvsimple.Delete(view1)"
+delete_pv_object(view1)
+print "delete_pv_object(view1)"
# Step 3
# Replace the current view with chart line one
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view1 = pvsimple.CreateXYPlotView()
xy_view1.ChartTitle = 'TEST table of real'
# Display curve
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_rep = pvsimple.Show(table_csv)
# Delete
source = cutlines.Input
-pvsimple.Delete(source)
-pvsimple.Delete(med_reader)
+delete_pv_object(source)
+delete_pv_object(med_reader)
# Clear views from scalar bar and update views
for rview in pvsimple.GetRenderViews():
# 2. Create curves viewer
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
# 3. Display curves in the viewer
# Create curves
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
# xy_rep = pvsimple.Show(table_reader)
# Create curves
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_rep = pvsimple.Show(table_reader)
def delete_with_inputs(obj):
"""Deletes the given object with all its inputs"""
import pvsimple
+ import presentations
obj_to_delete = obj
while obj_to_delete is not None:
if hasattr(tmp_obj, 'Input'):
obj_to_delete = tmp_obj.Input
- pvsimple.Delete(tmp_obj)
+ presentations.delete_pv_object(tmp_obj)
def get_png_picture_resolution(infile):
"""Returns size (width, height) of the PNG image"""
# 2. Show curves
cur_view = pvsimple.GetRenderView()
if cur_view:
- pvsimple.Delete(cur_view)
+ delete_pv_object(cur_view)
xy_view = pvsimple.CreateXYPlotView()
xy_view.ChartTitle = "The viewer for Curves from the Table"
scalar_map.Visibility = 1
pvsimple.Render()
-pvsimple.Delete(scalar_map)
+delete_pv_object(scalar_map)
pvsimple.Render()
lookup_table, "")
reset_view()
- pvsimple.Delete(bar)
+ delete_pv_object(bar)
# 4. Delete the created objects, recreate the view
delete_with_inputs(scalarmap)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(isosurfaces)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(cutplanes)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(deformedshape)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(gausspoints)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(plot3d)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(prs)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(vectors)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
# 4. Delete the created objects, recreate the view
delete_with_inputs(cutlines)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
prs = eval(name + "OnField(med_reader, EntityType.NODE, med_field, 1)")
if prs is None:
print "ERROR!!! ", name," presentation wasn't created..."
- # StreamLines presentation is empty for "vitesse" field defined in the loaded MED file.
+ # StreamLines presentation is empty for "vitesse" field defined in the loaded MED file.
# TODO: check why stream lines prs is empty
if name == "StreamLines":
print "WARNING: Stream lines presentation is empty!"
# 4. Delete the created objects, recreate the view
source_list = GetSources().values()
for source in source_list:
- Delete(source)
+ delete_pv_object(source)
-Delete(GetActiveView())
+delete_pv_object(GetActiveView())
view = CreateRenderView()
# 5. Execution of the created script
if errors > 0:
raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."
-
-
SaveTrace(path_to_save)
# 3. Delete the created objects
-Delete(table_reader)
+delete_pv_object(table_reader)
# 4. Execution of the created script
execfile(path_to_save)
save_trace( path_to_save, text )
# 3. Delete the table
-Delete(table)
+delete_pv_object(table)
# 4. Execution of the created script
execfile(path_to_save)
save_trace( path_to_save, text )
# 3. Delete the table
-Delete(table)
+delete_pv_object(table)
# 4. Execution of the created script
execfile(path_to_save)
# 3. Find IsoSurfaces
from pvsimple import *
+import presentations
obj = FindSource('IsoSurfaces')
if obj is None:
print "FAILED: can't find IsoSurfaces!!!"
# 4. Remove med reader object and all other sources
for obj in GetSources().values():
- Delete(obj)
+ presentations.delete_pv_object(obj)
# 5. Check results
obj = FindSource('ScalarMap')