It looks like you're new here. If you want to get involved, click one of these buttons!
Hello Matthias,
I have a small problem. I want to merge all shapes of a certain layer of a cell. All shapes are already polygons. I am not sure how to do it, since you usually need an array of polygons for the merge command. The only way I know of to adress the shapes needed would be:
cell_name.each_shape(layer_name) do |shape|
xxx
end
But with this method I dont know how to proceed.
Another idea I tried was with the ShapeProcessor. It looks like:
processor = RBA::ShapeProcessor.new
processor.merge_to_polygon(cell_name.shapes(layer_name), 0, true, false)
The last command needs an array as argument. But the "cell.shapes()" command should give us a list of shapes according to the class documentation. Isn't a list of shapes equivalent to the required array?
Thanks for your help in advance!
Greetings,
Elias
Comments
I found the simplest solution for my problem:
The problem at hand is solved, but just out of curiosity, I would still like to know how to make the list of shapes ( gained by: cell_name.shapes(layer_name)) to an array to use it for the command stated in the previous comment.
Thanks again,
Elias
Hi Elias,
You can turn a
Shapescontainer into aShapearray with a loop:But this is not really efficient and when you have a hierarchy of cells, this loop will just convert one cell, not it's children.
Actually
ShapeProcessoris a bit limited in it's use as is it's brotherEdgeProcessor. The reasoning behindEdgeProcessorandShapeProcessoris that the former operates on raw objects (Polygon,Edge, ...) while the latter works on the more genericShapeobjects. Both classes implement polygon boolean operations. They allow a great degree of control what you do, but they are a bit unhandy.I'd recommend using the newer
RegionandEdgesobjects which act as polygon and edge containers and support higher level operations through their methods. Both can be created from a real layout using theRecursiveShapeIteratorwhich is a powerful tool to address the shapes from cell trees or subtrees:The
Edgesclass allows handling of edges (the connecting lines of the polygon vertexes). There is a rich set of methods on these containers you may like to explore. In fact, the DRC engine is built around these two objects mainly and is implemented as a thin wrapper around these. InRegionandEdgesyou have access to these methods without your code.If you want to script layout manipulations alone, the DRC feature may be easier to use because it wraps all the overhead of retrieving and storing polygons. Merging a layer in a DRC script looks like this:
Matthias
Thank you Matthias for your thorough answer. I will look into these objects.