Jump to content
Sign in to follow this  
Guest

How to get Mass/Area/Volume of a Comp in a macro

Recommended Posts

Guest

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...

Share this post


Link to post
Share on other sites
Guest

try the following code

proc calculateAreaOfComp {compNameId} {# computes the area of the surfaces in a componentset areaOfSurfaces 0.0*createmark surfaces 1 "by comp name" $compNameIdset surfaceList [hm_getmark surfaces 1]*clearmark surfaces 1foreach iSurface $surfaceList {    set areaOfSurfaces [expr ($areaOfSurfaces + [hm_getareaofsurface surface $iSurface]) ]	    }return $areaOfSurfaces}

Share this post


Link to post
Share on other sites
Guest

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}

Share this post


Link to post
Share on other sites
Guest

Hi Cesar,

thank you for your help.

It's almost what I needed...

But I'm searching for a way to get the informations of meshed components.

e.g. after importing a Nastran-Input-Deck (-> there is no geometry, just mesh)

Share this post


Link to post
Share on other sites
Guest

After you import the nastran deck, you could run a script to create surfaces from the mesh and place them in the proper collector. or manually create the surfaces with "FE to surface".

Share this post


Link to post
Share on other sites
Guest

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.

Share this post


Link to post
Share on other sites
Guest

some posted this command to search the hypermesh api, you could search for the word 'mass' or 'area'.

lsearch -all -inline $g_base(coreProcs) *mass*

.......

Share this post


Link to post
Share on other sites
Guest

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.

Share this post


Link to post
Share on other sites
Guest

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...