How to prompt user to select node, and store its X,Y,Z locations

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

Hi,

 

I am writing a tcl script and I am trying to get the user to inform the script of where the script should be taking place. I want to request this by having the user select (pick) a node.

 

From this node I would want to retrieve the X,Y,Z locations of that node, and store them in a variable and proceed with the rest of the script.

 

How might I do this?

 

Thanks in advance for the help!

 

Tyler 

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017

    Figured it out!

     

    #Prompt user to pick node
    *createmarkpanel nodes 1 'Please select Node'
    set BNode [hm_getmark nodes 1]
    set Z_Node [hm_getentityvalue NODE $BNode 'z' 0]

  • tinh
    tinh Altair Community Member
    edited March 2017

    Hi,

    Note that 'z' data name is local coordinate

    if you want to get root coordinate, use 'globalz' data name, or simply:

    lassign [expr [hm_nodevalue $BNode]] X_Node Y_Node Z_Node