bar = get_bar()
bar.Orientation = 'Horizontal'
bar.Position = [0.1, 0.1]
- bar.Position2 = [0.1, 0.25]
+ #bar.Position2 = [0.1, 0.25]
bar.AspectRatio = 3
display_only(scalarmap, view)
print("Position =", bar.Position)
# 8. Size of scalar bar
-print("Default Height=", bar.Position2[1]," : Width=", bar.Position2[0])
+print("Default Length=", bar.ScalarBarLength," : Thickness=", bar.ScalarBarThickness)
print("Set positive Height and Width")
h = 0.4
-w = 0.2
-bar.Position2 = [w, h]
-print("Size =", bar.Position2)
+w = 0.2 * 600 * 0.4
+bar.ScalarBarLength = h
+bar.ScalarBarThickness = int(w)
+print("Length=", bar.ScalarBarLength," : Thickness=", bar.ScalarBarThickness)
print("Set negative Height and Width")
h = -0.4
-w = -0.2
-bar.Position2 = [w, h]
-print("Size =", bar.Position2)
+w = -0.2 * 600 * 0.4
+bar.ScalarBarLength = h
+bar.ScalarBarThickness = int(w)
+print("Length=", bar.ScalarBarLength," : Thickness=", bar.ScalarBarThickness)
# 9. Number of colors
print("Default number of colors = ", scalarmap.LookupTable.NumberOfTableValues)
scalarmap.LookupTable.NumberOfTableValues = nb_colors
print("Number of colors =", scalarmap.LookupTable.NumberOfTableValues)
+# NumberOfLabels no longer exists since Paraview 5.4
+
# 10. Number of labels
-print("Default number of labels = ", bar.NumberOfLabels)
-
-print("Set negative number of labels")
-nb_labels = -10
-bar.NumberOfLabels = nb_labels
-print("Number of labels=", bar.NumberOfLabels)
-
-print("Set zero number of labels")
-nb_labels = 0
-bar.NumberOfLabels = nb_labels
-print("Number of labels=", bar.NumberOfLabels)
-
-print("Set positive number of labels")
-nb_labels = 10
-bar.NumberOfLabels = nb_labels
-print("Number of labels=", bar.NumberOfLabels)
+# print("Default number of labels = ", bar.NumberOfLabels)
+
+#print("Set negative number of labels")
+#nb_labels = -10
+#bar.NumberOfLabels = nb_labels
+#print("Number of labels=", bar.NumberOfLabels)
+
+#print("Set zero number of labels")
+#nb_labels = 0
+#bar.NumberOfLabels = nb_labels
+#print("Number of labels=", bar.NumberOfLabels)
+
+#print("Set positive number of labels")
+#nb_labels = 10
+#bar.NumberOfLabels = nb_labels
+#print("Number of labels=", bar.NumberOfLabels)
# 11. Scalar bar title
print('Default Title ="', bar.Title, '"')
#============Stage8: bar size of Scalar Map On Deformed Shape===========
print("Changing bar size:")
-print("Default [width, height]: ", bar.Position2)
+print("Default ScalarBarLength: ", bar.ScalarBarLength)
+print("Default ScalarBarThickness: ", bar.ScalarBarThickness)
-print("Set height = height*1.2")
-height = bar.Position2[1] * 1.2
-bar.Position2[1] = height
-print("Bar [width, height]: ", bar.Position2)
+print("Set length = length*1.2")
+length = bar.ScalarBarLength * 1.2
+bar.ScalarBarLength = length
+print("Bar length: ", bar.ScalarBarLength)
pvsimple.Render(view)
-print("Set width = width*2")
-width = bar.Position2[0] * 2
-bar.Position2[0] = width
-print("Bar [width, height]: ", bar.Position2)
+print("Set thickness = thickness*2")
+thickness = bar.ScalarBarThickness * 2
+bar.ScalarBarThickness = thickness
+print("Bar thickness: ", bar.ScalarBarThickness)
pvsimple.Render(view)
#=============Stage9: nb of colors of Scalar Map On Deformed Shape======
print("Number of colors: ", lt.NumberOfTableValues)
pvsimple.Render(view)
+# NumberOfLabels no longer exists in Paraview 5.4
#=============Stage10: nb of labels of Scalar Map On Deformed Shape=====
-print("Changing number of labels:")
-print("Default number of labels: ", bar.NumberOfLabels)
+#print("Changing number of labels:")
+#print("Default number of labels: ", bar.NumberOfLabels)
-print("Set negative number of labels")
-num = -128
-bar.NumberOfLabels = num
-print("Number of labels: ", bar.NumberOfLabels)
-pvsimple.Render(view)
+#print("Set negative number of labels")
+#num = -128
+#bar.NumberOfLabels = num
+#print("Number of labels: ", bar.NumberOfLabels)
+#pvsimple.Render(view)
-print("Set zero number of labels")
-num = 0
-bar.NumberOfLabels = num
-print("Number of labels: ", bar.NumberOfLabels)
-pvsimple.Render(view)
+#print("Set zero number of labels")
+#num = 0
+#bar.NumberOfLabels = num
+#print("Number of labels: ", bar.NumberOfLabels)
+#pvsimple.Render(view)
-print("Set positive number of labels")
-num = 256
-bar.NumberOfLabels = num
-print("Number of labels: ", bar.NumberOfLabels)
-pvsimple.Render(view)
+#print("Set positive number of labels")
+#num = 256
+#bar.NumberOfLabels = num
+#print("Number of labels: ", bar.NumberOfLabels)
+#pvsimple.Render(view)
#=============Stage11: bar title of Scalar Map On Deformed Shape=========
print("Changing bar title:")
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_scalarmap.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_isosurfaces.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_cutplanes.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_deformedshape.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
# 3. Dump Study
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_gausspoints.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_plot3d.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_prs.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_vectors.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
bar = get_bar()
bar.Position = settings["Position"]
-bar.Position2 = settings["Size"]
-bar.NumberOfLabels = settings["NbLabels"]
+#bar.Position2 = settings["Size"]
+#bar.NumberOfLabels = settings["NbLabels"]
bar.Title = settings["Title"]
bar.Orientation = settings["Orientation"]
errors += 1
# Size of scalar bar
-width = recreated_bar.Position2[0]
-height = recreated_bar.Position2[1]
+#width = recreated_bar.Position2[0]
+#height = recreated_bar.Position2[1]
-if abs(width - settings["Size"][0]) > tolerance:
- print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
- errors += 1
-if abs(height - settings["Size"][1]) > tolerance:
- print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
- errors += 1
+#if abs(width - settings["Size"][0]) > tolerance:
+# print("ERROR!!! Width of scalar bar is incorrect: ", width, " instead of ", settings["Size"][0])
+# errors += 1
+#if abs(height - settings["Size"][1]) > tolerance:
+# print("ERROR!!! Height of scalar bar is incorrect: ", height, " instead of ", settings["Size"][1])
+# errors += 1
# Discretize
discretize = recreated_cutlines.LookupTable.Discretize
errors += 1
# Number of labels
-nb_labels = recreated_bar.NumberOfLabels
-if nb_labels != settings["NbLabels"]:
- print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
- errors += 1
+#nb_labels = recreated_bar.NumberOfLabels
+#if nb_labels != settings["NbLabels"]:
+# print("ERROR!!! Number of labels of scalar bar is incorrect: ", nb_labels, " instead of ", settings["NbLabels"])
+# errors += 1
# Title
title = recreated_bar.Title
error = error+1
error = error + compare_lists(bar.Position, [0.85, 0.05])
-error = error + compare_lists(bar.Position2, [0.12, 0.43])
+#error = error + compare_lists(bar.Position2, [0.12, 0.43])
if error > 0:
raise RuntimeError("There is(are) some error(s) was(were) found... For more info see ERRORs above...")
bar = get_bar()
bar.Orientation = 'Horizontal'
bar.Position = [0.1, 0.1]
- bar.Position2 = [0.1, 0.25]
+# bar.Position2 = [0.1, 0.25]
bar.AspectRatio = 3
display_only(scalarmap, view)
error = error + compare_lists(bar.Position, [0.01, 0.01])
# Scalar bar size
-bar.Position2 = [0.05, 0.5]
-error = error + compare_lists(bar.Position2, [0.05, 0.5])
+#bar.Position2 = [0.05, 0.5]
+#error = error + compare_lists(bar.Position2, [0.05, 0.5])
# Number of colors and labels
smondefshape.LookupTable.NumberOfTableValues = 4
-bar.NumberOfLabels = 5
+#bar.NumberOfLabels = 5
nb_colors = smondefshape.LookupTable.NumberOfTableValues
-nb_labels = bar.NumberOfLabels
-error = error + compare_lists([nb_colors, nb_labels], [4, 5])
+#nb_labels = bar.NumberOfLabels
+#error = error + compare_lists([nb_colors, nb_labels], [4, 5])
+error = error + compare_lists([nb_colors], [4])
# Title
bar.Title = 'Pression, Pa'