How to measure the volume of all components
Altair Forum User
Altair Employee
I have a model with several (CAD) solid components, no mesh yet. I want to measure the volume of all the components with a TCL script. Can someone help me with this?
There's a previous topic (How to measure volume,area and mass using tcl) asking how to measure the volume with a component with TCL, with this as one of the answers for just one component:
*createmark comps 1 $compid hm_volume comps 1
And on another topic I fond how to iterate thru all components:
*createmark comps 1 all set comp_list [hm_getmark comps 1] foreach comp $comp_list { # do something here puts 'Comp= $comp' }
However I dont know how to combine both instructions to get the volume of all components.
Thanks
0
Answers
-
Just replace :
*createmark comps 1 $compid
by:
*createmark comps 1 'all'
0 -
Ok, I figured it out:
*createmark solids 1 all set solid_list [hm_getmark solids 1] foreach solid $solid_list { *createmark solids 1 $solid set vol [hm_getvolumeofsolid solid $solid] puts '$vol' }
0