Need help with shape counting example - New to scripting in Klayout

edited September 2015 in Ruby Scripting
Hi,

Have been using Klayout and love it.
Wanted to get started on scripting.
I tried but cannot get the shape counting example to run, not sure what I am doing wrong.
It dies at the line shown below:

lv.each_object_selected do |sel|
>>>>Dies Here. shape = sel.shape

Ruby message window says: "Cannot call non-const on a const reference in ObjectInstPath::shape"
I have seen other examples referred to in the forums and example scripts that use the same method to access a highlighted shape.
So I am sure I am doing something wrong.

Using Klayout Version 0.24 on Windows 7 (64 bit)

Please Help!!

Thanks

Reddy

Comments

  • edited September 2015

    Reddy,

    Which example exactly? I'm not familiar with that one. Can you send the link?

    Aha, you are using version 0.24.0? Upgrading to the latest version (0.24.1 at time of writing) will fix the problem, as detailed in the Known bugs and issues (scroll to "A workaround is to use...").

    Note: You don't need to uninstall 0.24.0 (at least on Windows) in order to install 0.24.1. Just install 0.24.1 on top of the old one.

    If you can't upgrade for some reason, replace

    shape = sel.shape
    

    with

    shape = sel.dup.shape
    

    Let us know if it works!

    David

  • edited November -1
    Hi David,

    You were correct. 0.24.1 fixed it.

    I did uninstall 0.24 before installing 0.24.1, just to be safe.

    " shape = sel.shape " works.

    Thank you.

    Reddy
  • edited November -1

    Hi David,

    thanks for this hint. Sorry again for messing things up ...

    Matthias

Sign In or Register to comment.