hm_getentityvalue issue

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi All,

I have to get the material id information using tcl once the user selects the elements or components in the screen. I am trying to use below command.

hm_getentityvalue comps 12 'materialid' 0;

But unable to get the information on material id. I am even okay with getting material name string.

Can someone please help me to know how to achieve this task.

Thank you,

Regards,

Prasad Poduval

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2013

    Hi,

     

    try to use:

     

    hm_getentityvalue comps 12 material.id 0 -byid

     

    Regards,

    Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2013

    Hi Mario,

     

    I Appreciate your help. Thanks. But it is not working. Below is what i tried as per your advice.

     

    *createmarkpanel comps 1 'Please enter component';
    set E [hm_getmark comps 1]
    hm_getentityvalue comps $E material.id 0 -byid

     

     

    I have a material with id 1 assigned to this component.

     

    Thank you,

    Regards,

    Prasad poduval

    Hi,

     

    try to use:

     

    hm_getentityvalue comps 12 material.id 0 -byid

     

    Regards,

    Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2013

    Hi,

     

    if it doesn't work, then take the detour via property number. I have checked it, it's working...

     

    *createmarkpanel comps 1 'Please enter component...'
    set comp_number [hm_getmark comps 1]
    *clearmark comps 1
    set prop_number [hm_getentityvalue comps $comp_number 'property.id' 0 -byid];
    set mat_number [hm_getentityvalue props $prop_number 'material.id' 0 -byid];
    tk_messageBox -message 'CompNb: $comp_number -- PropNb: $prop_number -- MatNb: $mat_number'
     

    Regards,

    Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2013

    Hi Prasad,

     

    To  get the material id from TCL Tk code is different based on solvers.  If you use PamCrash profile you can directly get it like

    hm_getentityvalue comps 12 material.id 0 -byid

     

    But if you are using nastran profile then

     

    *createmarkpanel comps 1 'Please enter component...'
    set comp_number [hm_getmark comps 1]
    *clearmark comps 1
    set prop_number [hm_getentityvalue comps $comp_number 'property.id' 0 -byid];
    set mat_number [hm_getentityvalue props $prop_number 'material.id' 0 -byid];
    tk_messageBox -message 'CompNb: $comp_number -- PropNb: $prop_number -- MatNb: $mat_number' is best.

     

    Which is given by Mario..

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2013

    Hi Mario/Mohan,

     

    Thanks for that piece of info and inputs. This was really helpful and it is working.

     

    Really appreciate your help.

     

    Thank you,

    Regards,

    Prasad poduval