Creating a large number of structures with different names


#1

In some situations you might be interested in creating a large number of structures and assign each of them a particular name, visible in the Object tree. For example, imagine you wanted to create a periodic array of cylinders, where each cylinder is identified by a number:

In principle you could do that following the approach described in:
https://kb.lumerical.com/en/index.html?ref_scripts_tutorial_array.html
https://kb.lumerical.com/en/index.html?ref_sim_obj_array_structure_group.html

These approaches work very well even if you have a large number of structures in the array. However, all the structures will be named in the same way, “circle”, in the Object tree. If you want to have different names for each object, you can rename them using a script; however, running such a script could take a long time if the renaming procedure is not done in an efficient way.

I have attached a script that allows you to create an array of cylinders where each one has a different name in the object tree. The script creates one column at a time and renames all the elements in the column before proceeding to the next one. This method turns out to be more efficient than creating the entire array and going through it renaming each element. For small arrays the method’s efficiency is not noticeable, but if you try a huge array, for example of 81x81 elements, then the speed up is significant.

many_circles.lsf (1.3 KB)


Speed up GUI when making large number of objects