How to get THIC1s value?

Bhavik Sheth_21143
Bhavik Sheth_21143 Altair Community Member
edited November 2023 in Community Q&A

Hello All,

I am iterating through all components in the model and want to extract the value of THIC1s from property.

Any suggestions on how to achieve this?

Thank you in advance.

 

Best Answer

  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited November 2023 Answer ✓

    Hello,

    I am trying to get value by hm_getentityvalue but facing one problem.

    I am able to fetch the property's id and name but not other values. Please check the attached image for details.

    I want to get value from THIC1s.

    Is there anything i need to change in command?

    Please guide.

    Hello @Bhavik Sheth,

    Did you make sure through the matrix Browser that THIC1 was the correct attribute name to be queried in HyperMesh?

    The first step is really to retrieve the correct atteibute name this way, then to use hm_getvalue

    Hope this helps

    Michael

Answers

  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited November 2023

    Hello @Bhavik Sheth ,

     

    For getting this information, we first need to know if the 1D property is assigned to the component (what we call indirect assignment) or to the elements directly (what we call direct assignment).

     

    If you are using indirect assignment, you can easily thanks to the matrix browser query the components. Once you get the component column, request for its property attribute, then from the property column request for THICC1.

     

    If you are using direct assignment, you need to take a longer path, as the property is not an attribute of the component anymore, but of the elements inside the component. 

     

    In that case, I would recommend to use the following commands

    *createmarkpanel comps 1 "Select bar elements"

    foreach Comp [hm_getmark comps 1] {

         *createmark elems 1 "by comp" $Comp

         set RefElem [lindex [hm_getmark elems 1] 0]

         set Thic1 [lindex [hm_getvalue elems id=$RefElem dataname=property.pbarlDIMarray] 0]

         puts "Thic1($Comp) = $Thic1"

    }

     

    for the line 

     set Thic1 [lindex [hm_getvalue elems id=$RefElem dataname=property.pbarlDIMarray] 0]

     

    I defined a pbarl in HyperMesh, section tube, and I used Matrix Browser to retrieve the attribute of interest. You may need to repeat the operation on your model to make sure you need to request for the same attribute.

    image

     

    Also, the commands I sent you just prompt the information in the tcl console. If you need more, please look in Altair Exchange, there are multiple examples of scripts with commands for exporting data in a text file.

     

    Hope this helps,

    Michael

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited November 2023

    Hello @Michael Herve 

    Thank you for the information.

    The explanation that you have given is very useful for me as I am new to scripting for Hypermesh.

    I will check on the suggested method.

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited November 2023

    Hello,

    I am trying to get value by hm_getentityvalue but facing one problem.

    I am able to fetch the property's id and name but not other values. Please check the attached image for details.

    I want to get value from THIC1s.

    Is there anything i need to change in command?

    Please guide.

    Test.PNG 132.7K
  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited November 2023 Answer ✓

    Hello,

    I am trying to get value by hm_getentityvalue but facing one problem.

    I am able to fetch the property's id and name but not other values. Please check the attached image for details.

    I want to get value from THIC1s.

    Is there anything i need to change in command?

    Please guide.

    Hello @Bhavik Sheth,

    Did you make sure through the matrix Browser that THIC1 was the correct attribute name to be queried in HyperMesh?

    The first step is really to retrieve the correct atteibute name this way, then to use hm_getvalue

    Hope this helps

    Michael

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited November 2023

    Hello @Bhavik Sheth,

    Did you make sure through the matrix Browser that THIC1 was the correct attribute name to be queried in HyperMesh?

    The first step is really to retrieve the correct atteibute name this way, then to use hm_getvalue

    Hope this helps

    Michael

    Hi @Michael Herve,

    The property name is LSD_THIC1s and by accessing this I am getting the required result.

    Thank you for the help.

  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited November 2023

    Hi @Michael Herve,

    The property name is LSD_THIC1s and by accessing this I am getting the required result.

    Thank you for the help.

    thanks @Bhavik Sheth for your feedback!