Using *createentitypanel for single entity selection

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

I need to ask the user to specify one and only one line. From what I understand (according to this help document: https://www.sharcnet.ca/Software/Hyperworks/help/hm/hmbat.htm?_createentitypanel.htm), the only way to accomplish that is by using *createentitypanel <entity_type> <message> followed by hm_info lastselectedentity <entity_type> to reference the selected entity.  However, when I use the code below, I always get the message 'No line selected'.

 *createentitypanel lines 'Select line' if {[hm_info lastselectedentity lines] == 0} {     hm_errormessage 'No line selected' }

What am I doing wrong?

Tagged:

Answers

  • vipin_22401
    vipin_22401 Altair Community Member
    edited May 2018

    Hi nothing wrong in the above code, it is working for me :huh:/emoticons/default_huh.png' title=':huh:' />

    if you need to get the line id, use hm_info command immediately after createenttitypanel.

     

    *createentitypanel lines 'Select line'
    set lineId [hm_info lastselectedentity lines]

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited May 2018

    Well, that's strange. the exact thing I pasted into my post that wasn't working yesterday now works just fine.