#!python #open the mesh you'd like to delete elements from #cubit.cmd('open "meshedknuckle.cub"') #add all hexes with quality below threshold to group 'ugly' cubit.cmd('group "ugly" add quality hex all jacobian high 2.5') #get a list of all of their IDs group_id = cubit.get_id_from_name("ugly") hex_list = cubit.get_group_hexes(group_id) #construct a string with these IDs hex_string = "" for i in range(len(hex_list)): hex_string += str(hex_list[i-1]) + " " #construct the command to delete all these command = "delete hex " + hex_string #issue the command cubit.cmd(command) #redraw the mesh to show quality on the remaining mesh cubit.cmd('quality volume all Jacobian global draw mesh')