Hello,
I use Klayout to do transformation of designs to adapt with a direct laser writer.
I would like to scale my design with different values horizontally and vertically. The scale function only has one parameter. Is there a way to do this anyway?
Any help would be greatly appreciated! :)
Theo
Comments
http://178.77.72.242/svn-public/klayout-resources/trunk/scripts/scale_anisotropic.lym
I tried to execute it, but I get an error:
undefined local variable or method `gt' for AnisotropicScaling:Module
/Users/theophane/.klayout/macros/AnysotropicScaling.lym:40:in `<module:AnisotropicScaling>'
/Users/theophane/.klayout/macros/AnysotropicScaling.lym:13:in `<main>'
[edit] I copied from Firefox instead of importing the script with the "macro development" tool
With regards to your original question: I assume you want to anisotropically scale the whole layout (all shapes on all layers in all cells) by some fraction, like 1.1,1.2 (10%,20%). Is that correct? In that case you could write a script but it's not trivial so I wanted to understand the question before starting to offer the wrong answer.. (I don't currently have such a script, it would be some work to write.) So you are looking for Edit > Layout > Scale, but with two parameters.
With regards to your second question:
David
Thank you for your answer.
I indeed copied the text instead of importing it. Noticed my mistake after 20 minutes :)
What I want to do is scaling my whole design with different values for x and y. This is the equivalent to Edit>selection>scale but with two values.
This script works really well, it scales my whole design. You have to flatten the design first (which can be slow or impossible, but that is to be expected as it seems too complicated to do an anisotropic scaling on instances.
The situation is: I measure alignment crosses with a laser exposer and I want to align the layer with scaling in order to improve the alignment accuracy.
The layer sizing you propose is more like a "growing" function as I understand it. It increases the size of the different shapes by x and y um (additive) without moving the shapes. I don't really want that, I want to increase the size of the design by factors of x and y. But thanks for the tip, this function can be really useful to adapt the critical dimension when there is overexposure!
Théo
Hi Theo,
hierarchical, anisotropic scaling is possible, but that involves generation of variants for differently oriented cells. Right now, flattening is the only feasible option.
Flattening is considerably faster if you don't chose undo support. Flattening by script is also possible and maybe more efficient. In general, the scaling script will do the scaling within Ruby which is probably very slow too. I efficient solution on big data sets can only be done within C++.
Apart from scaling - this is just a very simple correction. Will you finally need other (affine) corrections as well? Like rotation, shear and trapezoid? There actually is a transformation class for that (
Matrix3d
), but then flattening is mandatory.Matthias
I understand it is complicated, It would be nice not to have to flatten, but right now, I can work with it.
Flattening is quiet fast (I used to work with clewin and it is lightening fast in comparison), but past a certain number of polygons, it seems to run indefinitely. Is it possible to flatten with the built in functions and disable the undo function, or do I have to develop a ruby script?
edit: found it. When flattening a cell, the software ask to disable the undo function but when using edit>selection>flatten_instances, it does not ask. But the program still freezes if there are too many structures to flatten
This is a really interesting point, I actually use scaling combined with other transformations to simulate shear and trapezoid, so this would be a very nice addition! Would it be possible to have a generic transformation where we can specify a matrix of transformation?
Thank you for your help
Théo
Hi Theo,
you can disable globally by calling KLayout with the "-i" option for that purpose.
Flattening is a memory-consuming operation often. Small layouts may explode to an infinite number of shapes if you're unlucky. Freezing may be an effect of swapping. Can you check whether the process runs out of physical memory?
Matthias
I have a design with an array of ~1500 cells. The flattening of one cell seems instantaneous. If I try to flatten the whole design containing this array of 1500 cells, the memory doesn't increases so much that it starts to swap, but klayout starts to use 100% of the thread. I let it run for two hours before killing the program. (same behavior with Linux and OS X).
If I flatten only one third of the cells, it works and ends after less than 3 minutes.
If a reduce the number of polygons in the cell composing the array, it works.
I cannot really investigate farther.
Théo
Hi Theo,
Looks like a there is a performance trap here.
I think I can provide a solution in 0.24.4.
Best regards,
Matthias
It indeed seems to work now when the undo function is bypassed, thanks!
Théo