Coordinates of a node in hyperview using TCL

Rachit Semalty
Rachit Semalty Altair Community Member
edited August 2022 in Community Q&A

Hi. I want to know the coordinates of a node using TCL code in hyperview. My main task is to find a node attached to a component (not orphan nodes) that is farthest from the origin. I am planning to find coordinates of all the nodes, around 1000-2000, and then sort them. Is there any other better way? I want the node that has maximum value of the z coordinate.

 

Regards,

Rachit

Best Answer

  • Nagahashi Kouta
    Nagahashi Kouta Altair Community Member
    edited August 2022 Answer ✓

    Hi, Rachit Semalty

    The following script will help you.

    hwi OpenStack
    hwi GetSessionHandle sess
    sess GetProjectHandle proj
    proj GetPageHandle page [proj GetActivePage]
    page GetWindowHandle win [page GetActiveWindow]
    win GetClientHandle cln
    cln GetModelHandle mdl [cln GetActiveModel ]

    set node_set [mdl AddSelectionSet node]
    mdl GetSelectionSetHandle node_sel $node_set
    node_sel Add "all"

     

    set node_coord_list [list ]

    mdl GetQueryCtrlHandle qry
    qry SetQuery "node.coords"
    qry SetSelectionSet $node_set
    qry GetIteratorHandle iter
    for {iter First} {[iter Valid]} {iter Next} {
         lappend node_coord_list [lindex [iter GetDataList] 0]
    }

     

Answers

  • Nagahashi Kouta
    Nagahashi Kouta Altair Community Member
    edited August 2022 Answer ✓

    Hi, Rachit Semalty

    The following script will help you.

    hwi OpenStack
    hwi GetSessionHandle sess
    sess GetProjectHandle proj
    proj GetPageHandle page [proj GetActivePage]
    page GetWindowHandle win [page GetActiveWindow]
    win GetClientHandle cln
    cln GetModelHandle mdl [cln GetActiveModel ]

    set node_set [mdl AddSelectionSet node]
    mdl GetSelectionSetHandle node_sel $node_set
    node_sel Add "all"

     

    set node_coord_list [list ]

    mdl GetQueryCtrlHandle qry
    qry SetQuery "node.coords"
    qry SetSelectionSet $node_set
    qry GetIteratorHandle iter
    for {iter First} {[iter Valid]} {iter Next} {
         lappend node_coord_list [lindex [iter GetDataList] 0]
    }

     

  • Rachit Semalty
    Rachit Semalty Altair Community Member
    edited August 2022

    Hi, Rachit Semalty

    The following script will help you.

    hwi OpenStack
    hwi GetSessionHandle sess
    sess GetProjectHandle proj
    proj GetPageHandle page [proj GetActivePage]
    page GetWindowHandle win [page GetActiveWindow]
    win GetClientHandle cln
    cln GetModelHandle mdl [cln GetActiveModel ]

    set node_set [mdl AddSelectionSet node]
    mdl GetSelectionSetHandle node_sel $node_set
    node_sel Add "all"

     

    set node_coord_list [list ]

    mdl GetQueryCtrlHandle qry
    qry SetQuery "node.coords"
    qry SetSelectionSet $node_set
    qry GetIteratorHandle iter
    for {iter First} {[iter Valid]} {iter Next} {
         lappend node_coord_list [lindex [iter GetDataList] 0]
    }

     

    Thanks, Nagahashi, the code worked fine for me. 

    Regards,

    Rachit