Can't process multi-polygon problem

edited February 2018 in Ruby Scripting
Dear Matthias:
Thanks for your support with useful tool. I have some
problem in process many polygon. My purpose is create
box in each point of every polygon. But it can't work
if number of polygon > 2. Please kindly help me to modify
if possible. Thanks a lot.

BR

Here is my script:

app = RBA::Application.instance
mw = app.main_window

lv = mw.current_view
if lv == nil
raise "No view selected"
end
size = 50
axis = 0
poly_num = 0
lv.each_object_selected do |obj|

shape = obj.shape
layout = lv.cellview(obj.cv_index).layout

if shape.is_polygon? || shape.is_box? || shape.is_path?
x_data = Array.new()
y_data = Array.new()
polygon = shape.polygon
poly_num = polygon.num_points_hull
for i in 0..(poly_num-1)
axis = polygon.point_hull(i)
x_data.push(axis.x)
y_data.push(axis.y)
end
layout2 = RBA::Layout::new()
top = layout2.create_cell("TOP")
l1 = layout2.layer(1, 0)
for i in 0..(poly_num-1)
top.shapes(l1).insert(RBA::Box::new(x_data.at(i)-size, y_data.at(i)-size, x_data.at(i)+size, y_data.at(i)+size))
end
end
layout2.write("t.gds")
end

Comments

  • edited November -1
    I know why... it should refer this example...thanks anyway

    cv = RBA::CellView::active
    cv.cell.shapes(cv.layout.layer(104, 0)).insert(RBA::Box::new(0, 0, 100000, 150000))
Sign In or Register to comment.