Renumber nodes by distance

Seçkin13
Seçkin13 Altair Community Member
edited October 2020 in Community Q&A

Hi all

 

I would like number selected nodes by distance according to a node or coordinate system.

 

I thought creating a list from createmarkpanel. Then by using hm_measureshortestdistance, i tried to get the closest node and renumber it.

 

After numbering i removed the node from list . In for loop i supposed it will be ok.

 

However i missing something. 

 

I am looking for your help

 

Regards

 

 

 *createlistpanel nodes 1 set nodelist [hm_getlist nodes 1] set nodelist_num [llength $nodelist]  puts $nodelist_num  for {set i 1} {$i<=$nodelist_num} {incr i} { *createmark nodes 1 $nodelist  set closenode [hm_measureshortestdistance2 120 120 550  nodes 1 0 0] set cnode [lindex $closenode 4] *createmark nodes 1 $cnode *renumbersolverid nodes 1 [expr $i+52300000] 1 0 0 0 0 0 regsub $cnode $nodelist '' nodelist  set nodelist_num [llength $nodelist]  puts $nodelist_num  *clearmark nodes 1   }

 

Tagged:

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited September 2020

    Note: if you have 500 nodes and you want to renumber them from 100 to 600, it's better firstly renumber all to outside of [100,600], for example [10000,10500]. After that you can use script to get numbering inside [100,600]

     

  • Seçkin13
    Seçkin13 Altair Community Member
    edited September 2020

    Thank you Nguyun

     

    You are right, I always renumber with big numbers than use script

     

    In my code however hm_measureshortestdistance not working properly.

  • Seçkin13
    Seçkin13 Altair Community Member
    edited September 2020

    Sorry all i found my mistake.I had to use {*} sign before marking list.

     

    {*}$nodelist