Hypermesh scripting: How to get 2d element area

Lamster
Lamster New Altair Community Member
edited June 2023 in Community Q&A

Writing a code and I would like get the area of a 2d shell element component.

My command currently looks like...

*createmark elements "by comp id" 10000002

set area [ hm_get***** ] 

Am struggling with the hm_get aspect. Any ideas anyone?

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2023

    Something like below should work.

     

    set area [hm_getvalue elements id=10000002 dataname=area]

    or, if it is a list os elements

    set elems_list {1 2 3 4}

    set area_list [hm_getvalue elements user_ids=$elems_list dataname=area]

     

     

     

  • Lamster
    Lamster New Altair Community Member
    edited June 2023

    Many thanks, alas I keep getting a zero as a response... it's not signalled an error so I think we're on the right path but it's not returned the area. 

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2023
    Lamster said:

    Many thanks, alas I keep getting a zero as a response... it's not signalled an error so I think we're on the right path but it's not returned the area. 

    (Documents) 52 % *createmarkpanel elems 1
    (Documents) 53 % set elems_list [hm_getmark elems 1]
    4763 4765 4766 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4805 4817 4818 4820 4821 4822 4824 4825 4826 4827 4828 4829 4830 4831 4832 4888 4889 5209 5210 5211 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5279 5289 5290 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5328 5329 5330
    (Documents) 54 % set area_list [hm_getvalue elements user_ids=$elems_list dataname=area]
    1.6484999999999e-06 1.6365439999999e-06 1.6511775e-06 1.6372030000001e-06 1.6398299999998e-06 1.6344264999997e-06 1.6299529999998e-06 1.6343195000002e-06 1.634412e-06 1.6417760000001e-06 1.6363255e-06 1.6425779999999e-06 1.6354129999999e-06 1.6376384999999e-06 1.6299810000002e-06 1.6462445e-06 1.6263060000001e-06 1.6489549999998e-06 1.6584e-06 1.6560740000002e-06 1.6771009999999e-06 1.645155e-06 1.6436409999998e-06 1.6442089999999e-06 1.6511459999997e-06 1.648851e-06 1.6502420000001e-06 1.6492280000002e-06 1.6505125000001e-06 1.6482145000002e-06 1.6510025000001e-06 1.6523620000001e-06 1.6515025e-06 1.6528505000001e-06 1.6452540000001e-06 1.6428295000002e-06 1.6420549999998e-06 1.643424e-06 1.6386619999999e-06 1.646561e-06 1.6484415000001e-06 1.6566900000001e-06 1.6450099999999e-06 1.6438380000001e-06 1.6740540000001e-06 1.6311440000001e-06 1.6485459999999e-06 1.6339460000001e-06 1.688803e-06 1.6407774999997e-06 1.6367200000001e-06 1.6439940000001e-06 1.6479630000001e-06 1.6480480000002e-06 1.6533264999999e-06 1.6249709999998e-06 1.6304249999999e-06 1.6425229999999e-06 1.647767e-06 1.6425950000001e-06 1.6465424999999e-06 1.6267025e-06 1.6262850000002e-06 1.6930340000002e-06 1.6465800000004e-06 1.6597349999997e-06
    (Documents) 55 %