It looks like you're new here. If you want to get involved, click one of these buttons!
Dear Klayout developers,
I want to import all technogies of a folder with a ruby file. I discover that it can be created and modified by https://www.klayout.de/doc-qt5/code/class_Technology.html#m_technologies_from_xml.
I have the .lyt files in each technology folder. However when I try to import a .lyt with the instruction technology_from_xml, the continuos error is that there is a parse error.
Any idea to do this file? It has to be easy but I also try to use load_options and it happens the same problem
Comments
Could you please provide details? Like how you call the function and what's the error message?
Matthias
I attach you the layer property file changing the format from .lyt to .txt because the forum doesn't allow to attach other file formats.
My initial code is:
include RBA
Enter your Ruby code here
mitech = RBA::Technology.technology_from_xml('haspfhohap.lyt')
And the error message is:
XML parser error: error occurred while parsing element in line 1, column 1 in Technology::technology_from_xml
pruebas.rb:4:in
technology_from_xml' pruebas.rb:4:in
Thank you Mattias
Is it really difficult to use code formatting in this forum? This is hardly readable. There is a nice editor and you can use the "Code" paragraph formatting so I don't have to guess what this garbage is supposed to mean.
And "technology_from_xml" reads and XML string. So don't pass the file name, but the content of the file. Like (error handling missing):
Matthias
oh, sorry matthias. I just copy the code and I don't see the final preview.
Thank you for your answer.
Dear Matthias,
At the beginning, it seems that it works and it generates the technology.
CODE 1
So I develop a code to read all the technology folders and technologies in a file
CODE 2
It seems that the second works because it doesn't show any error.
However, it seems that in the process to develop that code I crash something inside Klayout because I try to run the first code again and It doesn't work. I have unistall klayout, delete the Klayout folder in Users, reboot computer in each step to have a clean instalation of klayout, everything to have a clean installation of klayout. I have Windows operating system.
However, now the first code doesn't works. The macro runs and it doesn't show any error, but the technology is not appear in the manager of technologies. I also use the functions _manage and _create, and it seems that internally is create the technology, but it doesn't appears in the manager of technologies.
Matthias, do you know how to fix this? I think it's something to do with the kernel or something, but it's strange that when reinstalling everything from scratch, the most basic example doesn't work.
UPDATE:
Finally I can do a workaround, creating a technology for each technology, loading the .lyp and chaging the explicit_base_path
Rebooting will never put KLayout into a different state. Reinstalling doesn't change something either. If you want to clean your KLayout installation remove the KLayout folder in "%HOME%\KLayout" (on Windows). That's it. I think what you're observing is that Ruby garbage collector hits you.
You have not told me what you want to do with the technologies you load.
You're not storing the technology objects somewhere. I assume this makes Ruby garbage collect them on a more or less random occasion. This happens when you use "technology_from_xml". I wonder how these technologies become available to the system. They should not be registered and not become visible.
"create_technology" registers the technology and this will make Ruby not clean up the object. Hence this approach is immune against the GC issue.
TLDR: keep the last approach.
Matthias