How to get Mass/Area/Volume of a Comp in a macro
Hi everybody,
does anyone how to get the area / mass / volume of a component in a macro?
I'm searching for anything like:
' set area [hm_getcomparea $comp] '
or structural / non-structural mass or volume of this component.
I need it especially for Nastran models, but it would be great to have a solver-independet way (for at least: area, volume and total mass).
Can anybody help me?
Thank you...
Find more posts tagged with
for the volume
proc calculatevolumeOfComp {compNameId} {# computes the vol of solids in a componentset volumeOfSolids 0.0*createmark solids 1 'by comp name' $compNameIdset solidList [hm_getmark solids 1]*clearmark solids 1foreach iSolid $solidList { set volumeOfSolids [expr ($volumeOfSolids + [hm_getvolumeofsolid solids $iSolid]) ] }return $volumeOfSolids}
Good Idea, but I don't thick this way works on a whole BIW with > 300 PSHELL properties and
> 500.000 elements in less then 8 hours (on a fast machine)...
In 'Tool -> mass calc' is the fuction I'm searching for.
The values of this function should be my new variables, but I don't find a command like:
[hm_getareaofsurface ...] for a single element or a comp.
I've got a complete runable model with all porperties and materials and I just would like to know the area of the elements of a certain component.
Maybe anyone of Altair knows a way how get this information in same time as using 'mass calc' in a macro.
try the following code, it will create the a surface from the fe model. for a 250k element (aprox. 100 components) frame model, it took less than one hour to generate the surfaces from the mesh.
proc createSurfacesFromComp {} { set compNameList [hm_complist name] foreach compName $compNameList { *createmark elems 1 'by comp name' $compName # some code is needed here for just selecting 2d elements. if other type of elements are present, there may be an error. *createmark elems 2 *fetosurfs 1 2 123 1200 0.1 0 }}
some code is needed to avoid an error if mark No1 does not contain any 2d element. I think should not contain any other type of elements, just 2d elements.
If you want to get the area of existing mesh, you can sum up the area of individual elements on a component by component basis. Each element area is already an attribute stored for each element.
*createmark elems 1 'by comp' comp1set comp_el_list [hm_getmark elems 1] set comp1_area 0foreach id $comp_el_list { set el_area [hm_getentityvalue elements $id 'area' 0] set comp_1area [expr $comp_1area + $el_area] }
This way you won't need to generate the geometric surfaces. There is also a 'volume' entity for solid elements.
These are not solver specific, and would work on mesh from any source. I would also recommend looking at the 'masscalc' or 'components' in the hminstalldir/templates/summary directories for some other examples, although these are in template language, not tcl.
try the following code