Install .rbm tools in Klayout in Mac

edited October 2015 in Ruby Scripting
Hello, I am relatively new to Mac.

I have Klayout under Applications (as typical, I think), but where would I put the .rbm file to make it appear in the menu?

Quite often I see description as below:
It is possible however, to implement such a function in ruby. Just copy the code below to a file with extension .rbm (i.e. compute_area.rbm) and copy that file into the installation directory of KLayout. It will add a new entry to the "Tools" menu which computes the area of all objects selected.


I know what to do in Windows, but since I'm using a Mac now, any ideas?
Thank you very much for your help.

Jack

Comments

  • edited October 2015

    Hello Jack,

    I think there are several ways to achieve what you want to do.
    Perhaps, the simplest way is to set "KLAYOUT_PATH" environment variable.

    Assuming that you are using the binary package for Mac, you may edit the Bash
    script file that invokes KLayout.
    For example, if you want to place *.rbm files under ${HOME}/temp directory, add

    export KLAYOUT_PATH=$HOME/temp
    

    [Ref. Dropbox]
    https://www.dropbox.com/s/zagsv4d8sv8f0tp/2015-1008-Jack.png?dl=0
    The image shows such an example where I added some customized menus by *.rbm files.

    Hope this helps you.
    Kazzz

    <<< File to be edited >>>
    /Applications/klayout.scripts/KLayoutEditor.app/Contents/MacOS/KLayoutEditor.sh
    
    
    #!/bin/bash
    #-----------------------------------------------------------------------------------
    # File: KLayoutEditor.sh
    #
    # Author: Kazunari Sekigawa (sekigawa@titan.ocn.ne.jp | kazunari.sekigawa@gmail.com)
    # Tested on: Mac OSX (10.10.5), Yosemite
    # Last modified: October 04, 2015
    #-----------------------------------------------------------------------------------
    # Descriptions:
    #  This is to invoke "klayout" distributed as a binary package for Mac
    #  in "editor" mode.
    #
    #  You may specify style and other options as you like by setting
    #  "opt_style" and "opt_others" variable in this script.
    #-----------------------------------------------------------------------------------
    export KLAYOUT_PATH=$HOME/temp
    
    #---------------------------------------------------------
    # With "-n" option, multiple instances can be invoked
    #---------------------------------------------------------
    myKLayout="open -n -a /Applications/klayout.app --args "
    
    #===================================================
    # Pass command line parameters to klayout
    # vvvvvvvvvv You may edit the block below vvvvvvvvvv
    opt_mode="-e"
    opt_style="-style=cleanlooks"
    opt_others=""
    # ^^^^^^^^^^ You may edit the block above ^^^^^^^^^^
    #===================================================
    options="$opt_mode $opt_style $opt_others"
    targetfiles=$@
    
    echo "### Starting KLayout in Editor mode..."
    $myKLayout $options $targetfiles &
    
    exit 0
    
    #-------------------
    # End of file
    #-------------------
    
  • edited November -1
    Sekigawa,

    Thank you for your help.
    I found another way: Show the package contents of Klayout, and copy the .rbm file to MacOS folder, then it's done!

    Jack
Sign In or Register to comment.