Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Xsection module changes: dynamic stipple and layer-list issues?

I am running a ruby script (from xsection module) that creates a new layout, cell, and cell-view. Somehow, that action takes with it the layer definitions from the calling layout. The output function in xsection finds or creates a new layer based on the runtime commands. BUT the layer list in the gui doesn't update after it is all done. I have to select each layer and edit the properties. All properties are correctly filled in with the new values already, and after I click ok, they finally do update in the GUI. Is there an update command anywhere that forces the GUI to update the displayed layer list ? How do I clear out all layers completely in the new layout, in a way that the gui wont remember the name, layerindex, and/or datatypeindex ?

This brings me to the second part. I want to change the stipple of the layers that are going to be generated with XS. I have already updated the output function to take in a stipple index. But somehow, it changes the old layer index's stipples, not the new ones. I don't have a good way of finding the new target layer, and change the stipple of only that one. This may be related to the fact that the old layers are somehow imported when XS creates a new layout window.

Help ?

here is my modified output function from XS:

def output(layer_spec, layer_data, stipple)
view = RBA::LayoutView::current
ls = string_to_layerinfo(layer_spec)
li = @target_layout.layer(ls);
lInfo = @target_layout.get_info(li)
puts "Layer #{li}: Name = " + lInfo.name
@target_layout.set_info(li, lInfo)
@target_layout.update
puts "Layer #{li}: Name = " + lInfo.name
view.update_content
i = 0
view.each_layer() do |lref|
if i == li
puts "layer(#{li}).dither_pattern = #{lref.dither_pattern}"
lref.dither_pattern = stipple
puts "layer(#{li}).dither_pattern = #{lref.dither_pattern}"
end
i = i + 1
end

puts "drawing on layer #{li}: " + @target_layout.get_info(li).to_s
puts "numlayers = #{@target_layout.layers}. Layers before draw : " + @target_layout.layer_indexes.to_s
puts "layerinfos = " + @target_layout.layer_infos.to_s
shapes = @target_layout.cell(@target_cell).shapes(li)
shapes.clear # new feature

confine the shapes to the region of interest

@ep.boolean_to_polygon([ RBA::Polygon.new(@roi) ], layer_data.data, RBA::EdgeProcessor::mode_and, true, true).each do |polygon|
shapes.insert(polygon)
end
puts "polygons drawn on layer #{li}: " + @target_layout.layer_infos.to_s
@target_layout.set_info(li, lInfo)
@target_layout.update
end

Comments

  • edited December 5

    Hi,

    the code is very difficult to read. Please use triple backticks before the first and after the last line to format source code (Markdown markup).

    What exactly did you modify?

    I basically think it does not have to be that complicated. XS can load a layer properties file. So why not just loading a specific file?

    Maybe I should explain a basic detail which is often misunderstood: the layout object will hold that geometry data you have. The layer list including the stipples etc. is separate from this and tells KLayout what to show. Because there is no direct correspondence, KLayout can reference multiple layouts in one view, filter layers and apply transformations when drawing. So it's not sufficient to modify the layout, you also have to modify the layer list in the layout view. The easiest way to do this is to load a layer properties file.

    Matthias

  • Hi Matthias,
    thanks for getting back to me. I have modified a bit now. When I am finished and happy with it, I can post it somewhere.

    Also, in the meantime, I have resolved the issue through trial and error. I ended up clearing all layers first, then adding new ones, then changing the properties (like line style, color , stipple etc). It was a bit complicated because the layers from the calling layout came from a automatically loaded tech layer file. I think that caused the GUI not to take my new name/layer/datatype.

    I modified the output function to also take color, stipple, etc.

    And I added a SaveScreenShot function so that people can build a sequence of processing slides without having to stop at every step.

    Two things that bugs me is that during the execution:

    (1) I can only do 1 ruler. I have tried to change you code to allow more rulers, and while it is running ok, the content of any layout beyond the first genereated is wrong. I have to crawl into your instantiations and global variables to make it happy.

    (2) While the xsection routine is running, the screen does not get updated. It would be absolutely fantastic for demonstrational purposes if there was a way in ruby to force all updates and wait until it is finished before continuing, maybe also pause it for a set time. There is probably a way, but this is a bit out of my league. Any suggestions there ?

    Thank you ! And Happy Nikolaustag !

    Thomas.

  • Hi Thomas,

    thanks for your attempts.

    For avoiding KLayout to take the current technology, you can try using

    cv = app.main_window.create_layout("", 1)
    

    in line 994 (original code). "" is the default technology. But it can still be associated with a layer properties table. If such a layer properties file is configured, it will indeed not show new layers if the "add missing layers" option is disabled. In this case, you actually do need to clear and establish a new layer properties set.

    Multi-Ruler should be possible by a loop, with some care. This is mainly because the current_view will change from iteration to iteration. This probably will screw up things unless you pass a specific view.

    For the step-by-step question there is a related discussion already: https://www.klayout.de/forum/discussion/comment/4888#Comment_4888

    Regards,

    Matthias

  • Hi Matthias,
    the "4888" link is where I started :-) Unfortunately, the step-by-step is with user input only.
    Maybe I should clarify. I would like the code to run uninterrupted by user prompts or windows that pop up. The current xsection module runs 20 - 30sec to completion. However, the layout (screen) only updates after everything is complete. In fact, the new layout is only added after the code ends. I would like to be able to let the program run, but force an update to the screen so that the layout xsection flashes up as it progresses.
    What's the magic sauce to do that ?

    Thanks.

    Thomas.

Sign In or Register to comment.