Write file containing hex8 element volumes

I am using Cubit to generate a mesh file that I use later with a LS-DYNA analysis. The finite element analysis will require knowledge of every hex8 solid element volume. Is there a way to have Cubit write the element volumes to an ASCII file?

Thanks for your help

How about something like this

set logging on file ‘elem_vol.txt’
quality volume all element volume list detail
set logging off

You will probably have to edit the file to get it in the format you want but all the data is there. There are ways to do this from python as well and format it exactly how you want but this is probably the easiest method.

Another recommendation is to try something like the “save_hex_volumes” python script:


open up a file. YOU SHOULD SET THE PATH so you know where the file is going.

fp = open("/<path_to_file>/hex_volume.txt", “w”)

create a group with all of the hexes and get the group id

cubit.cmd(“group ‘all_hexes’ add hex all”)
group_id = cubit.get_id_from_name(“all_hexes”)

get a list of all hexes in the group

hex_list = cubit.get_group_hexes(group_id)

loop through all the hexes, find the volume and print it out

for hex_id in hex_list:
tmp_list = [hex_id] # the get_mesh_volume_or_area function is looking for a list as input
volume = cubit.get_meshed_volume_or_area(“hex”, tmp_list);

# build an output string by concatenating a list of strings and write it out
output_string = "Hex: "  + str(hex_id) +" volume = " + str(volume) + "\n"
fp.write( output_string)

close the file