I need to write the cell name of each instance of a rather large array(~400x400) to a text file by its location. For example, an array of 2x3 intances with the name "AA"~"FF", the content of the output file should be like this:
AA BB CC
DD EE FF
Each name is placed by the location of each instance. I have the rough idea of traversing instances in the cellview directly, but I'm not sure about the sequence. Dose it traverse certainly from the left to the right first and then from the top to the bottom? If it is, then the script is simple(suppose the array size is row*col, the origin of top left instance is (x0 y0), the pitch of horizontal and vertical is x_pitch and y_pitch):
foreach(inst cv~>instances
if(car(instace~>xy) == x0 then printf("\n"))
printf("%s " inst~>name)
)
But if the traversing sequence is random. It will be time consuming for the script:
for(i 1 row
for(j 1 col
foreach(inst cv~>instances
if(col == 1 then printf("\n"))
if( ((car(inst~>xy) - x0)/x_pitch + 1) == row && ((y0 - cadr(inst~>xy)/y_pitch + 1) == col then
printf("%s" inst~>name)
)
)
)
)
In this case, it seems that we need a method to get the instance by the coordinate of its origin. But I didn't find such a method. Any better idea?