How to get node id from coordinates?

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hi All,

 

I have x, y ,z coordinates  and I have  system ID also.

Eg: {0 0 25} and system ID :658001

Suppose, a node is present in the model at the above location, How to get the node ID using HM APIs?

Note :hm_closest node is not working for me.

 

Regards

Gopal

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi

    sure, hm_getclosestnode is not working with local coordinate, you have to provide global coordinate

    maybe, there is some commands to calculate global coordinate, please search them

    below I will create a node at that position, and retrieve its global coordinate to provide to hm_getclosestnode

    *createnode 0 0 25 658001 ; #create a node at the coordinate

    set NodeId [hm_latestentityid nodes]

    set gx [hm_getentityvalue nodes $NodeId globalx 0]

    set gy [hm_getentityvalue nodes $NodeId globaly 0]

    set gz [hm_getentityvalue nodes $NodeId globalz 0]

    *createmark nodes 1 -1

    *nodemarkcleartempmark

    puts [hm_getclosestnode $gx $gy $gz]

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hi tinh,

     

    Thanks for your suggestion.

     

    Regards

    Gopal