Very different behaviour of Windows and Linux Klayout Versions using layoutDD package

It can bee seen using layoutDD with the files in directory https://github.com/wsteffe/layoutDD/tree/master/Test.
Apply cmd "open DD project" of layoutDD menu selecting the file "printed_circuit_board_si_geom.gds" in that directory.
It will open the project in the correct way in the linux platform but it will fail in windows with following error displayed in Log Viewer:

AttributeError: 'NoneType' object has no attribute 'load_layout_options'
C:\Users\walter\KLayout\salt\layoutDD\python\layoutDD\loaders.py:117

For some reason the Technology loaded from the file is not associated to the layout in windows

mainWindow     = pya.Application.instance().main_window()
technology     =pya.Technology()
technology.load(filePath+".lyt")
mainCellView  = mainWindow.load_layout(gdsPath,technology.name,1)
mainLayout    = mainCellView.layout()
dxf_unit      = mainLayout.technology().load_layout_options.dxf_unit  

the last line is used to check that the technology was associated with layout.
The association is done in Linux but not in windows where mainLayout.technology() returns nil.

Comments

  • edited November 2023

    I am sorry but the Test folder at the https://github.com/wsteffe/layoutDD/tree/master/ is not complete. Please use that one here annexed. The difference is that the folder in the git repo includes only the input data while the data structure of the present folder was created after the input data were imported (using "Import Layout" from layoutDD menu) and a new Region has been defined (using "New Region" from layoutDD menu). A custom technology named "mil" (with dxf_unit=25.4 micron) was used in the import phase and written into the project folder.

    Test.zip 607.7K
  • edited November 2023

    I am not sure whether this is coincidence, but I think this is exactly the same issue discussed here: https://www.klayout.de/forum/discussion/2419/pypi-load-technology#latest

    TL;DR: this priblem is not related to Windows, but in the way you read the technology. Use "pya.create_technology(name)" and load the file into that technology object. Only then, a technology is registered in the system and "load_layout" will see it.

    Matthias

  • edited November 2023

    Hy Matthias, thanks for help.
    You are right. The difference was that "mil" tecgnology was already registered in my Klayout system on Linux but not on windows. So now I have put the following lines in openProject():

        technology  =pya.Technology()
        technology.load(filePath+".lyt")
        if not pya.Technology().has_technology(technology.name):
           technology=pya.Technology().create_technology(technology.name)
           technology.load(filePath+".lyt")
    

    Now it works on both OS (windows and linux) but I am still not fully satisfied because threre is the possibility that an other user working on the project has already registered a technology with same name and different parameters.
    It would be better if it were possible to use temporary technology stored in the project folder (instead of the system technology). The point is that when I reopen my project I would like that the properties of reloaded layout are the same as defined in the import phase (through a user selected technology). The most important property is dxf_unit which I am recovering with:

    layout.technology().load_layout_options.dxf_unit
    

    But also layout.dbu plays an important role (I am using layout regions which are defined in terms of dbu units). Anothr solution may be to save persistent data in the gds file as discussed in another post:

    data1 = RBA::LayoutMetaInfo::new("dxf_unit", value)
    data1.persisted = true 
    ly.add_meta_info(mi)
    
    data2 = RBA::LayoutMetaInfo::new("layout_dbu", value)
    data2.persisted = true 
    ly.add_meta_info(mi)
    

    But I am not sure about what are all the required data in order to have a consistent layout environment after reopening a Project. I think that reloding and reapplying the full technology should do the work but only if the user doesn't have registered a different technology with the same name.

  • Hi @wsteffe,

    Right now, a technology is referred to by a technology name for which there is only one repository system-wide. The Technology object cannot be used directly to attach it to a Layout for example.

    But in order to register a temporary technology, you can use a qualified name with some domain you own like "your.domain.org/temp-tech". This should be unique. You cannot prevent however that this technology shows up in the menus and in case you want to support multiple projects you have to make the name unique, e.g. by adding a unique suffix.

    Technologies are the mechanism, KLayout provides to supply a consistent layout environment. This does not only include file options but more important details such as verification decks. So I think this is a good choice. Some API enhancements are possible, e.g. some "register" and "unregister" method for the Technology, so you do not need to parse the .lyt file two times or a "hidden" flag that prevents the technology from showing in the menus.

    Matthias

Sign In or Register to comment.