gross_die.rbm is giving error with KLayout 0.26

edited May 2021 in KLayout Support

Hello,
I was trying to use the gross_die.rbm script with klayout 0.26.11. I saved the script in the installation folder. But I am getting the following script error as soon as I am starting KLayout. My OS is Windows10.

uninitialized constant MenuAction
C:/Users/supra/AppData/Roaming/KLayout/gross_die.rbm:23:in `main'

What am I doing wrong here? Please help.

Comments

  • I see that same error.

  • Hello,

    Can you try to add:

    class MenuAction < RBA::Action
      def initialize( title, shortcut, &action ) 
        self.title = title
        self.shortcut = shortcut
        @action = action
      end
      def triggered 
        @action.call( self ) 
      end
    private
      @action
    end
    

    before line:

    $gross_die = MenuAction.new( "Gross die / Yield", "" ) do

    It runs fine for me, but I noticed the "MenuAction" class was defined in another .rbm file I have present in my installation folder, so probably it is nowhere defined if you only have gross_die.rbm in the installation folder...

    Cheers,

    Tomas

  • @tomas2004 Thanks for pointing this out.

    However, you do not necessarily need MenuAction today. An Action can be directly bound to code using "on_triggered":

    action.on_triggered do 
      ... your code ..
    end
    

    Best regards,

    Matthias

  • @tomas2004
    It worked. Thanks a lot.
    It saved a lot of work. Thanks again.

    Best regards,
    Supratim

  • @ Matthias

    You always have a helpful hint, if only people ask.
    But that is a "lagging function".

    So let me ask this - when is your "Klayout Verification
    Scripting for Dummies" book coming out?

    That being a different thing than the manual, good
    as it may be.

    :*

  • edited May 2021

    Good idea. Yes, I should write that book!

    I got a title page already (https://imgflip.com/memegenerator/59165342/For-Dummies):

    :)

    Matthias

  • Hi Matthias,

    I have this problem too. With the addition of the snippet from your May 10 post, I get a new error:

    Ambiguous overload variants - multiple method declaration match arguments in Trans::initialize in Action::triggered
    ../gross_die.rb:455:in 'initialize'
    ../gross_die.rb:455:in 'new'
    ../gross_die.rb:455:in 'block in '
    ../gross_die.rb:31:in 'triggered'

  • I'm sorry, I don't maintain this script. And I cannot guess which is the patch you applied and how you did that.

    If it is useful, please create a project somewhere (GitHub if you like) and put the script there. This is a basis for debugging and further development.

    Matthias

Sign In or Register to comment.