How to export size of layer for over 1000 GDS files?

Hi sir,
I have over 1000 GDSII files , in the each file , we have some information such as DIE size .
Do you have any idea to load each file and exprot that data by script auto -batch ?

Export DIE size of current GDSII file is very easy.
die=input(71,0)
puts die.bbox.width
puts die.bbox.height

but the key issue will be that , I have over 1000 GDSII file. and I need to export that data of each one.

Comments

  • Hello,

    Assuming all your gds files are in the current folder:

    gdsfiles = Dir.glob("*.{gds,gds2}").sort!
    
    gdsfiles.each do |gdsfile|
    
      lay = RBA::Layout.new
      lay.read(gdsfile)
      # your code comes here
    
    end
    

    Cheers,

    Tomas

  • Exactly :) Thanks for the solution @tomas2004.

    I would also add "gds.gz" and "gds2.gz" to cover the gzip case.

    Matthias

  • Hi All,
    Thanks very much for your help.
    that is workable.

    Hi @Matthias
    This is a follow-up question, and I believe it's also a significant one. What are your thoughts (or idea ) on using AI to write KLayout scripts? I’ve tried asking AI about the topic question before, AI get me a code was almost executable, but still had some errors/bug/error message.
    I had to carefully read the error messages, and try multiple times to ask with AI, and refer to google resources before finally obtaining a usable script. Training AI to better understand KLayout seems to help ease the anxiety and hesitation of beginners, and could lower the barrier to entry for new users.

    I’m a Taiwanese person who isn’t very fluent in English. When I ask questions, I need to go through two layers of translation: first, converting the usage or operational logic into programming logic; second, translating the problems or difficulties I encounter from Chinese into English. It seems that AI can help solve this fundamental issue.

  • Hi @jiunnweiyeh,

    I think that AI can be great help for you. I noticed that the AI models have a fairly good knowledge about KLayout, which is probably because the sources are openly available.

    I personally feel a bit cheated because OpenAI monetizes my content without asking, but if there is a benefit for everyone, I'm okay with that.

    If you use AI, you need to have some experience how to give it the right context. Only that way you obtain good results. I personally experience two cases: when I talk to AI about something I have little knowledge about, I feel well informed and the conversation is fruitful. When I talk to AI about something I already have experience with, I often end up in loops of tedious variations of the same statement, without any real benefit and it feels like talking to some idiot. But maybe I am not good at prompt engineering.

    To me, AI is good for beginners, but not of much use for improving your expert knowledge.

    Matthias

  • Hi Matthias,
    Similarly, I’ve encountered a similar situation. I need to carefully convert what I want to express into proper prompts in order to communicate effectively with AI. This process also involves certain terms that are commonly used within our company — terms that are not proper Chinese or English, but rather “Chinglish” expressions that can easily lead to misunderstandings.
    As I mentioned before, my English proficiency is relatively weak, so directly reading replies from many KLayout users often leads to confusion. Since our company hasn’t purchased a commercial version of AI, my usage is very limited (such as character limits and inability to download files). I have to piece together the functionality I need from very fragmented information.

    Even this English message was originally written in Chinese, and I relied on AI to help translate it into English.

    Some of the KLayout scripting syntax provided by AI seems to have a basic structure, but still results in errors during actual execution. For someone unfamiliar with programming languages, this can be quite challenging.
    As you mentioned long~ time ago, I have a rather unusual usage habit… I use KLayout’s DRC environment and write Ruby scripts to modify GDS layouts.
    Perhaps this is the root cause of many of the issues I’ve encountered. :D

Sign In or Register to comment.