Insert a path in the current cell with the selected layer

edited October 2016 in Ruby Scripting

Hi,

I want to draw a path within my current cell with the selected layer.

Later, I will make calculation on the path points, so I need a ruby script.

First I need to know how to draw the path and my script does not work :

include RBA

app = RBA::Application.instance
mw = app.main_window
view = mw.current_view
cv = view.cellview(view.active_cellview_index)

pts = [RBA::Point.new(0,0),RBA::Point.new(0,20),RBA::Point.new(20,20)]
wdt = 10
cv.cell.shapes(0).insert(Path.new(pts,wdt))

Thank you,

OkGuy

Comments

  • edited October 2016

    Your script does work for me, but you have to zoom far in. Because your line is 20 nanometers not 20 microns as I assume you meant. You have to divide by the database unit. Personally I think of all the numbers in microns and do all the calculations in microns until the step where they become a real object (like a Point, Path, etc), and at that time I divide by dbu.

    That plus a few other fixes below.

    include RBA
    
    app = RBA::Application.instance
    mw = app.main_window
    view = mw.current_view
    cv = view.cellview(view.active_cellview_index)
    ly = view.active_cellview.layout
    dbu = ly.dbu
    
    pts = [RBA::Point.new(0/dbu,0/dbu),RBA::Point.new(0/dbu,20/dbu),RBA::Point.new(20/dbu,20/dbu)]
    wdt = 10
    layer_info = LayerInfo.new(1,0)
    layer_index = ly.layer(layer_info)
    cv.cell.shapes(layer_index).insert(Path.new(pts,wdt/dbu))
    
  • edited October 2016

    Thank you, it works fine, except that it uses the layer 1/0. But I can fix it.

    OkGuy

Sign In or Register to comment.