How do I get the rba scripts to run on the windows version of Klayout

edited December 2009 in KLayout Support
When I paste a script for the "area calculation", it will not run and gives me a syntax error

Comments

  • edited November -1

    Hi sedborg,

    What is the message and what line number does the error appear in?

    Best regards,

    Matthias

  • edited November -1
    Matthias,

    The message the appears is when I boot the program with the rba file is as follows:

    Ruby error: 'C:/Data/Downloads/compute_area.rbm:1: syntax error, unexpected $undefined, expecting '}'
    {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
    ^' (SyntaxError)

    Then the program just crashes.

    Thanks

    Scott E.
  • edited November -1

    Hi Scott,

    it looks like your editor pasted the RTF content, not just the code text.

    I provided a download link for the code here. This one should work.

    Best regards,

    Matthias

  • edited November -1
    Matthias,

    Thanks, that worked. I have one other question. Do you have a script that calculates the percent area based on the size of the window I can draw. That is what ever size I draw it calculates the area of the polygons divided by the area of the box I draw.

    Thanks

    Scott E.
  • edited November -1

    Hi Scott,

    with "area of the box" do you mean the area of the display window?

    Best regards,

    Matthias

  • edited November -1
    No, I mean the area of the edge of the die or the area of the box you can drag over the device.
  • edited December 2009

    Ok, I assume that's the bounding box of the cell then.

    If that is correct, this is a simple extension for the script: just replace line 41 by a calculation of the box area and the division by the latter:

    active_cv = lv.cellview(lv.active_cellview_index)
    dbu = active_cv.layout.dbu
    box = active_cv.cell.bbox
    box_area = dbu * dbu * box.width * box.height
    RBA::MessageBox.info("Total area", "Total area of selected objects is #{total_area} square micron (#{100*total_area/box_area}% of total cell area)", RBA::MessageBox.b_ok)
    

    I provided a download link for the new code here.

    Best regards,

    Matthias

  • edited November -1
    Matthis,

    Thanks for the update this works great.

    S.E.
  • edited November -1
    Matthias, The area code(above) you created for me worked in the old version of Klayout 0.18 but it crashes Klayout in the new version 0.21.
  • edited November -1

    Hi sedborg,

    I can reproduce the problem. It seems to be related to the build which is based on Ruby 1.9 and MSVC instead of 1.8 and MinGW. I'll try to trace down the problem and provide a fix in the next version 0.21.1.

    Best regards,

    Matthias

Sign In or Register to comment.