It looks like you're new here. If you want to get involved, click one of these buttons!
While I have been drawing GDS using the Ruby code successfully for a while, this is the first time I am trying to manipulate existing GDS by opening the existing file and manipulating the cells. After struggling for a couple days, I am realizing that I do not quite understand the format of the "shape" I am trying to manipulate and hence would like to request some help.
I read the documentation below but am still struggling:
The GDS is structured as:
Hence I open the GDS and select the TOPCELL with "Show As New Top" and try to run the code below. Each CELLxx has shapes only on one layer (0,0). After transformations, I wanted the shapes on (1,0) layer.
Any help/pointers would be most appreciated.
module MyMacro include RBA lv = Application.instance.main_window.current_view ly = lv.active_cellview.layout top_cell_idx = lv.active_cellview.cell.cell_index top_cell_name = ly.cell(top_cell_idx).name ly.dbu = 0.001 dxf = ly.layer(RBA::LayerInfo::new(0, 0)) wg0 = ly.layer(RBA::LayerInfo::new(1, 0)) ly.each_cell do |cell| next if cell.name == top_cell_name cell_name = ly.cell_name(cell.cell_index) si = ly.begin_shapes(ly.cell_by_name(cell_name), 0) while !si.at_end? # for each shape here, I would like to size each shape, move to a new layer and rotate by 90 degrees # not necessarily in that order as long as all transformations are done by the end # I tried various options including the line below but get an error # Should I be transferring each shape to a hull and then do the transformations?? # si_hull = si.shape # poly1 = RBA::Trans::new(2, false, 0, 0).trans(si_hull) # cell.shapes(wg0).insert(poly1) # OR # Performing transformations directly on the individual shapes?? # si.shape.transform(RBA::Trans::R90.trans(RBA::Point::new(0, 0))) # Please note that I want to write these manipulated shapes back in the same cell and delete the old shapes si.next end lv.add_missing_layers lv.select_cell(cell.cell_index, 0) lv.zoom_fit end end