It looks like you're new here. If you want to get involved, click one of these buttons!
Hi all,
I am new to klayout, and am trying to improve my coding skills...
I wish to create a macro that would compute the surface of all selected objects.
However, whenever i use a function from the LayoutView class, I have a message saying me I use an undefined method :
You can see my code on the image, as well as the message I get. Could anyone help me understand my problem ?
Also, with the function on_selection_changed, can I switch from macro to the principal view and select an object with the selection tool ? It would really help me out if it worked.
Thanks in advance,
Gweltaz
Comments
Hello,
there is a worked-out sample doing what you look for here: https://www.klayout.de/useful_scripts.html#calc_area.lym
Matthias
Hi Matthias,
Thanks for your help.
Regardless, can you explain why I would have the problem I show ? I fear I have difficulties understanding the functioning of the class system...
Gweltaz
You're calling the methods on the classes, but they are methods you need to call on objects.
So instead of
you probably want to say
Classes and Objects are basic concepts in object oriented programming.
Matthias
I finally understood it just yesterday while coding for another macro!
It makes perfect sense, now that I know !
Thanks a lot!