Extract color scheme ranges of quality graphical summary


is there a way how to extract information of color scheme ranges of quality values using Python?
Let’s say, I import a mesh and check its quality by selecting “Display graphical Summary” in Visual tab. I got the color scheme bar and the mesh according to the color scheme.
Moreover, other output are ranges of color scheme, e.g.:
Red ranges from…
Magenta ranges from…

I want to extract those ranges for Red, Magenta,…using some function/method compatible with Python. It is possible?

Thank you in advance.

Hi @moonwalk11,

Welcome to the forum. The range of color schemes is just determined by the minimum and maximum quality values binned into n categories. You can use get_elem_quality_stats to get the minimum and maximum values and the sorted set of elements.

For example,

from math import trunc
id_list = cubit.parse_cubit_list("face", "all")
single_threshold = 0.2
use_low_threshold = False
low_threshold = 0.0
high_threshold = 0.0
make_group = False
quality_data = cubit.get_elem_quality_stats("face", id_list, "scaled jacobian",single_threshold, use_low_threshold, low_threshold, high_threshold, make_group)
min_value = quality_data[0]
max_value = quality_data[1]
mean_value = quality_data[2]
std_variation = quality_data[3]
min_element_id = quality_data[4];
max_element_id = quality_data[5];
element_type = quality_data[6];
bad_group_id = quality_data[7]
num_elems = quality_data[8]
elem_ids = [ trunc(i) for i in quality_data[9:] ]
entity_type Specifies the geometry type of the entity
id_list Specifies a list of ids to work on
metric_name Specify the metric used to determine the quality
single_threshold Quality threshold value
use_low_threshold use threshold as lower or upper bound
low_threshold Quality threshold when using a lower and upper range
high_threshold Quality threshold when using a lower and upper range

[0] min_value [1] max_value [2] mean_value [3] std_value [4] min_element_id [5] max_element_id [6] element_type 0 = edge, 1 = tri, 2 = quad, 3 = tet, 4 = hex [7] bad_group_id [8] size of mesh_list [9]…[n-1] mesh_list sorted from low metric value to high

You can create your own histogram knowing the minimum, maximum, the number of bins you want, and the sorted element list.

Does this help?

Hi @karl

thank you for your answer. It looks like what I need.

Unfortunately, I need to at first solve my problem related to python. I got error

Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘module’ object has no attribute ‘get_elem_quality_stats’

related to the

cubit.get_elem_quality_stats(“face”, id_list, “Shape”,single_threshold, use_low_threshold, low_threshold, high_threshold, make_group)

Anyway, thank you.

How are you setting this up? Are you running from the journal editor in python mode or are you trying to run from an external python file? Also, what version of Cubit are you running?

What happens if you copy and paste the first part of the script into the Python tab in Cubit?


I am running python commands from journal editor in python mode.
I am using Cubit 11.1.
When I run 2-8 lines of your suggested code solution (that means up to “quality_data = cubit.get_elem_quality_stats…”), I got that above-mentioned error. I just copied those lines into editor in python mode and run it.

E.g. if I try another function such as “cubit.get_surface_quads(1)”, this particular function works fine.

Cubit 11.1 is very old. Sandia Cubit is at 16.x now. Coreform Cubit switched to a year numbering system (2022.6 currently) over a year ago. The quality function I referenced likely does not exist in that old version of Cubit.