How to Extract the component name from selecting node / element.

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

hi there,

 

i am trying to resolve the problem of extracting the component name.

 

1) if i am selecting the node / element.

2) then how to identified that which component name is that nodes / element is belongs too.

 

please resolve this issue. 

 

 

Regards

 

Adams

Answers

  • tinh
    tinh Altair Community Member
    edited April 2014

    Hello

    try hm_getentityvalue nodes nodeid collector.name 1 -byid

     

    please read topic about 'data names' in hypermesh help

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2014

    hi tinh,

     

    set a [hm_getmark nodes [*createmarkpanel nodes 1]];

     

    'set b [hm_getentityvalue nodes $a 'collector.name' 1 -byid] '

     

    puts 'col name : $b'

     

    it is not returning the name of the collector.

     

    Regards 

     

    Adams

  • tinh
    tinh Altair Community Member
    edited April 2014

    Hello Adams

    it should be:

     

    *createmarkpanel nodes 1 'Select a node';#this is an interactive command

    set a [hm_getmark nodes 1]

    set b [hm_getentityvalue nodes $a collector.name 1 -byid]; #if you did not or selected more than one node, this command will raise an error

    puts 'col name: $b'

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2014

    Hi tinh,

     

    with the code listed above i am not able to retrieve the name of the component.

     

    but when i am taking element as an entity then component name is extracted.

     

     

    in my problem set node is important, i want to extract the component name while selecting node only.

     

    thanks 

    Adams

  • tinh
    tinh Altair Community Member
    edited May 2014

    oh,sorry i forgot that one node can be belonged to 2 or more than 2 comps

    so if you have a node, first find elements attached to it

    *createmark nodes 1 $nodeid

    *findmark nodes 1 1 1 elems 0 2

    set elems [hm_getmark elems 2]

    foreach elemid $elems {puts [hm_getentityvalue elems $elemid collector.name 1 -byid]}