It looks like you're new here. If you want to get involved, click one of these buttons!
Hi all,
I am trying to use python (standalone) to get patch images from a drawing, but running into some issues. Ideally, I would be able to input a drawing and coordinates, and get a bitmap out. However, it would be fine to get a monochrome PNG out -- I could post-process from there.
Currently, I am able to get images out when I use coordinates of of a patch of about 10000x10000um, but when I go smaller (for features of about 100x100um), I get no output. Also, I would like to set it to show layers without fill (the diagonal lines) but unsure how to set this feature with python.
Here is my current code:
import klayout.lay as lay
import klayout.db as db
lv = lay.LayoutView()
ly = lay.CellView.active().layout()
lv.load_layout(in_file, 0)
lv.max_hier()
lv.save_image_with_options(out_file, w,h, 0, 0, 0, db.Box(x1, y1, x2, y2), True)
Any help would be greatly appreciated!
Edit: it seems like if I adjust the height and width, I am able to get smaller images. However, I now I would just like to get the stipple to be solid instead of hatched:
Comments
I guess the problem is with a specific detail of the standalone view. It still inherits concepts from it's UI times, specifically that is depends on some form of event loop. You need to call "lv.timer()" to establish a proper configuration. This could be included into "save_image" for convenience. If you like, drop me a ticket for this on GitHub: https://github.com/KLayout/klayout.
Also in your code you are using "db.Box" for the drawing rectangle while it should be "db.DBox" with micrometer coordinates.
Here is a working example:
This produces:
Matthias
How to draw multiple layers ? lp.source = "9/0"
How to directly pass the KLayout layout image to a parameter and convert it into a numpy array, rather than saving it to a file