Windows : Libraries and link

edited December 2012 in General
Hi Matthias,

is there a way to make a link file (under windows the extension is always .lnk :-( (so here we will have something.gds.lnk) be recognized as a valid gds file for use as a library?
Let me explain:
I have several gds file for different projects, located in different directory, which i want to be used as library, but i want to keep the gds file within these directory structure, not in a big and large single directory as libraries is.
Making a link does not work, since klayout do not recognize them as a valid gds library (or oasis),at least in windows, but this would be the ideal way.
Having a copy is not a good solution, since keeping everything updated can become a big mess.
Best Regards
Joël

Comments

  • edited December 2012

    Hi Joel,

    there are actually two ways to achieve this.

    The first option is to use the KLAYOUT_PATH environment variable. KLayout scans all configuration directories given in the path. Note that the path separator is ":" on Linux and ";" on Windows. For example (Windows):

    KLAYOUT_PATH=c:/lib/path1;c:/lib/path2
    

    In that case, KLayout looks for libraries in c:/lib/path1/libraries and c:/lib/path2/libraries (note that "libraries" is still required).

    Please also note that the GDS LIBNAME is used as the library name.

    Another option is to actively register libraries in a Ruby script run at startup. Such a script can look like this:

    libs = [
      [ "lib1", "c:\\libs\\lib1.gds" ],
      [ "lib2", "c:\\other_libs\\lib2.gds" ],
    ]
    
    libs.each do |n,l|
      lib = RBA::Library.new
      lib.layout.read(l)
      lib.register(n)
    end
    

    Mark this script as "autorun" and KLayout will automatically load these libraries on startup. The advantage of this approach is that the name of the libraries can be given freely.

    Using Ruby the script can be refined so it automatically scans certain directories or loads the library names and paths from some config file (similar to "cds.lib" for example).

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias,

    Great, these 2 solutions are even better than the link things!!
    Many thanks

    Joël
  • Hi Matthias

    I have tried the listed Ruby Script in Windows 10 getting the following error return
    Any ideas or just me not getting the path correct

Sign In or Register to comment.