write out hex elements on a surface

Hello users!
If you imagine a simple meshed(hex) volume and one surface of this volume: How can i write out with python all hexahedral element ids which are connecting, or bordering, this Surface?
Thank you!

You can create a group using Trelis’s extending parsing capability and then get the hexes out of the group. Something like this should work.

surface_id = 1
cubit.cmd("group ‘my_group’ equals hex in node in surface " + str(surface_id))
group_id = cubit.get_group_id(“my_group”)

hex_list = cubit.get_group_hexes(group_id)

Thank you very much, it works great!
Best regards,
Stefan