It looks like you're new here. If you want to get involved, click one of these buttons!
Sorry for newbie question. I need to rename cell layers based on external map file, so it should do what Layers | Rename command does but for all layers mentioned in map file.
Code iterate through current_view.each_layer(). However, name property is empty string and source always contain suffix that doesn't appear in GUI. I tried to assign values to name but this didn't affect values displayed in GUI. Assigning value to source duplicate layers.
Most likely I didn't mistakes in my assumptions about KLayout API, but what is right way to implement layer renaming?
Comments
Just a comment: Do you really need to program this? If programming is not necessary, you can consider using the user interface with "File > Reader Options" and a layer mapping description.
A sample code of my suggestion, from what I know, until now, regarding this tool's API:
@ocasta: Than you for suggestion! But in my case layer map file is Calibre CCI GDS map and it's not listed in "File > Reader Options".
@crizos: Thank you for help! I tried all your three suggestions, but they didn't work :-(
1. layer.name change works in Python (like print), but GUI was not updated;
2. Failed same way as you wrote;
3. names remained same in GUI but changed in layout.layer_infos(), but layout.delete_layer(i) removed all layer content.
I found working solution for my problem:
Hi EugeneZelenko,
yes, that solution should work.
I'm a bit puzzled, simply using "layer.name=..." should do the job. I'll check that.
I have created a ticket for this: https://github.com/KLayout/klayout/issues/276.
Matthias
Just in case, I used version 0.25.4.
Hi Eugene,
I fixed this issue now in the master and I'm about to release a 0.25.9 version which will contain this fix among some others.
It was an issue related to a wrong C++ signature used in the Python binding. Thanks for bringing this up.
Regards,
Matthias
Hi, Matthias!
Thank you for quick fix!
Layer Name Prefix is the name you want to name the layer with.
delay(ms) is number of milliseconds to delay each frame for
Add '(replace)' if YES will add the string '(replace)' to very end of frame/layer name
Only Apply to visible layers, if YES will only apply/rename to visible layers
Hope above information will help you. For more you can also check this link: http://pythonandmltrainingcourses.com/courses/best-python-training-in-noida/
Hi, Mattias!
I verified fix in your release build and it works fine on my side with original script (assigning name property).