🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

remove node from nodelist in loop

User: "tarup chordia"
Altair Community Member
Updated by tarup chordia

Hi,

Using script, i am trying to renumber a set of selected nodes using shortest distance from a point.

i am using following script to do that. In which I am trying to renumber closest node one by one and once renumbering is done, I want to remove that node from the selected node list. 

But it is not working as intended. Can some one help me what is wrong in the code? or is there any alternate method to do that through script?

*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+10] 1 0 0 0 0 0
regsub $cnode $nodelist '' nodelist
set *nodelist_num [llength $nodelist]
puts $nodelist_num
*clearmark nodes 1 }

 

 

Find more posts tagged with