Hi Matthias, all,
I've found the "Search and replace" feature by accident running Klayout in edit mode. This was quite useful to find some instances of given cells in an existing .gds, and browse from one to the next place.
Two suggestions of enhancements :
— make "search and replace" available for read-only mode, so that people can use to search without any risk of edition and so that more could find this feature by accident ;)
— create a "hierarchically below" option in the search part, to handle efficiently massive hierarchical layout (such as memory macro)
Thanks again for your great libre tool.
Comments
Hello,
thanks for the suggestion. In viewer mode, it has to be a "search only" tool naturally :-)
What do you mean by "hierarchically below"? Do you mean all cells below the current one, but only once? "All cells" will basically do this, but not just cells which are children of the current one. Is that your suggestion?
Thanks,
Matthias
I was indeed thinking about something like "all children cells of the current top cell", you're right.
Sorry, I didn't try the "all cells" option. It runs pretty well ! My second suggestion does not sound like a killer feature.
I could simply create a gds with the top cell whose children cells I want to browse. Then the "All cells" does the remaining job. I particularly like the parent cell field in the result list.
I'm trying to selectively reduce repeating texts in a layout for better visibility and tracing.
So I would like to find all strings in layout, summarize how many times does each string repeat, then delete each string that repeat more than 1000 times in layout.
I am thinking of using the custom query for that.
So few questions:
1. I have a query which extract all texts from a layout. But how can I get only the string value of a text?
2. Is it possible to run aggregate queries (GROUP BY) like in SQL?
Thanks, Itamar
Hi Itamar,
that is probably beyond what is possible with the search & replace function. The best way to do this is through a script. This gives you more freedom than the queries which are not as powerful as SQL (and they have not been designed to be so).
Matthias
I extracted the texts from a design file using two methods-
1. Using a search query (texts from cells *). That was very fast, only a few seconds. exporting to external file was also very quick
2. Using macro below. This was very slow and took 2.5 minutes.
Why is the query so much faster?
What can I do to make it faster?
Thanks, Itamar
module MyMacro
include RBA
app = Application.instance
mw = app.main_window
lv = mw.current_view
layout = lv.active_cellview.layout
cl = lv.current_layer
if cl.is_null? || cl.current.layer_index < 0
raise "No layer selected "
end
l1 = cl.current.layer_index
@text_array =[] #string, count, delete_flag
@text_array_size = 0
puts ("Start Time = " + Time.now.to_s)
layout.each_cell do |cell|
cell.shapes(l1).each do |shape|
if shape.is_text?
@text_array[@text_array_size] = shape.text.string
@text_array_size += 1
end
end
end
puts("array size =" + @text_array_size.to_s)
puts ("End Time = " + Time.now.to_s)
end
Hi Itamar,
well, Ruby is basically slower than C++ code (which the query is).
But I think there is some room for improvement here: have you tried to use @text_array.push rather than setting the nth member?
Matthias
I did some changes in the macro and ran it.
I can see it deleted some of the texts (it those texts that I can select\copy\paste).
But there are other texts which I can't select and the macro does not delete those.
Theye are the same color of the other shapes in the layer and they have certain location, but i can't delete them manually or thru a macro.
What is this kind of text?
How can I delete those?
Thanks much, Itamar