Write file containing hex8 element volumes

Topics related to importing and exporting file formats, etc.

Write file containing hex8 element volumes

Postby Cubit User » Fri May 25, 2012 3:20 pm

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
Cubit User
 
Posts: 44
Joined: Wed May 16, 2012 12:42 pm

Re: Write file containing hex8 element volumes

Postby csimsoft Moderator » Fri May 25, 2012 3:49 pm

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.
csimsoft
csimsoft Moderator
 
Posts: 244
Joined: Tue Feb 14, 2012 5:59 pm
Location: American Fork, UT

Re: Write file containing hex8 element volumes

Postby csimsoft Moderator » Tue May 29, 2012 7:55 am

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

#!python
#!python

# 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
fp.close()
csimsoft
csimsoft Moderator
 
Posts: 244
Joined: Tue Feb 14, 2012 5:59 pm
Location: American Fork, UT


Return to Importing/Exporting

Who is online

Users browsing this forum: No registered users and 0 guests

cron

Search / Mark

User Control Panel

Login

Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 5 minutes)
Most users ever online was 58 on Mon Jun 26, 2017 4:19 pm

Users browsing this forum: No registered users and 0 guests