It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I have a script that I used for long to draw a box all surrounding the full layout of the active cell.
But something is now wrong and I cannot figure out why cv.layout.is_valid_layer?(li) never pass.
Please, can you help to find the missing instruction to insert the boundary_box ?
Thanks, BRgds,
Laurent
# $description: BBox of the current cell L
# $autorun
# $show-in-menu
# $menu-path: tools_menu.end
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# DESCRIPTION: Compute and output the bounding box of a cell (all layers)
#
# Run the script with
# klayout -rm cell_bbox.rbm ...
# or put the script as "cell_bbox.rbm" into the installation path (on Unix for version <=0.21:
# set $KLAYOUTPATH to the installation folder).
#
app = RBA::Application.instance
mw = app.main_window
view = mw.current_view
cv = view.active_cellview
if !cv.is_valid?
return
end
cell = cv.cell
dbu = cv.layout.dbu
# implement undo
view.transaction("Boundary")
sel_layers = view.selected_layers
if !sel_layers || sel_layers.size == 1
sel_layers.each do |lp|
li = lp.current.layer_index
print("layer : #{li.to_s} : #{cv.layout.get_info(li).to_s} : #{lp.current.name}\n")
if cv.layout.is_valid_layer?(li)
boundary_box = RBA::Box::new(cell.bbox.p1, cell.bbox.p2)
cell.shapes(li).insert(boundary_box)
print("BBox drawn")
end
end
end
text = "Cell: #{cv.layout.cell_name(cv.cell_index)}\n\n"
text += "xmin: #{cell.bbox.left*dbu} micron\n"
text += "ymin: #{cell.bbox.bottom*dbu} micron\n"
text += "xmax: #{cell.bbox.right*dbu} micron\n"
text += "ymax: #{cell.bbox.top*dbu} micron\n\n"
text += "width: #{cell.bbox.width*dbu} micron\n"
text += "height: #{cell.bbox.height*dbu} micron\n\n"
text += "surface: #{cell.bbox.width*dbu*cell.bbox.height*dbu/1000000} mm2"
RBA::MessageBox::info("Cell Information", text, RBA::MessageBox::b_ok)
view.add_missing_layers
view.commit
view.update_content
view.zoom_fit
Comments
Hi Laurent,
I tried the script with 0.30.12 and it seems to work. I can select a layer and after running the script it will paste a box with the layout's dimension on that layer. Even undo works.
However there is a catch: when the selected layer does not exist yet - i.e. it is in the layer list, but not in the database, then this script will not work. This often happens when you use a layer properties file. It may contain layers that are not existing in the database. So either you create the target layer first, using "Edit/Layer/New Layer" or you modify the script to make sure the layer is created:
Best regards,
Matthias
If you can calculate the true Bbox, then can you make that a part of the "preselection" function to "localize" select?
Then, could you make that preselection look at an "instance" layer at the same time, and localize the "selectable set" to only objects with gen-Bbox if no "instance" object, or Bbox*drawn if present?
That's something I miss from Brand X, "back in the day" (they broke it now). Being able to constrain selectability to less than extents. Like the case of the I/O ring cell which has chip scale extents and can always offer itself to selection anywhere in the core when you'd really rather it did not.