A program to recognize and reward our most engaged community members
Hello,
I would like to know how to use a tcl code to get the volume of each comp I have in my model and export as a list in a excel file.
Thanks!
Hi,
hm_getmass can be used to get the volume of a component with id $comp_id:
hm_getmass
*createmark comps 1 $comp_idset temp [hm_getmass comps 1]set mass [lindex $temp 0]set <strong>vol </strong>[lindex $temp 1]set area [lindex $temp 2]
*createmark comps 1 $comp_id
set temp [hm_getmass comps 1]
set mass [lindex $temp 0]
set <strong>vol </strong>[lindex $temp 1]
set area [lindex $temp 2]
foreach comp_id [hm_entitylist comps id] {} can be used to loop through all comp ids.
foreach comp_id [hm_entitylist comps id] {}
At last a tcl list lst_vols can be writen to a .csv file:
set data [join $lst_vols "\n"]
set tempfile [open $filepath w+]
puts $tempfile $data
close $tempfile