Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthornikoh
    • CommentTimeFeb 22nd 2017
     

    I have written a python script that loads a layout file and exports screenshots of certain cells within that layout file (see below). I use the "lay_view.max_hier()" command to see the full hierarchy.

    Is there a way to display the bounding boxes of cells within the cell that I am exporting, as well as seeing the full hierarchy? If I change the hierarchy level, I can't see what's "inside" the cell. I have tried changing various settings and also opening the same layout in the same panel, but the hierarchy display levels seems to apply to all open layouts.

    import os
    import pya
    
    # layout file
    file_str = r'C:\test_layout.oas'
    os.chdir(os.path.dirname(file_str))
    
    # create directory for exported images
    script_file = os.path.splitext(file_str)[0]
    export_folder = script_file + '_images'
    os.makedirs(export_folder, exist_ok=True)
    
    # get main window object and load layout file
    mw = pya.Application.instance().main_window()
    cell_view = mw.load_layout(file_str, 0)
    
    # get layout view and cell view object
    lay_view = mw.current_view()
    cell_view_ind = lay_view.active_cellview_index()
    layout = cell_view.layout()
    
    for c in layout.each_cell():
      # only export images of cells whose name contains '_unit_cell'
      if '_unit_cell' in c.name:
        # set layout view to display cell
        lay_view.select_cell(c.cell_index(), cell_view_ind)
        w = c.bbox().width()
        h = c.bbox().height()
        lay_view.max_hier()
    
        # get cell bounding box and set layout view
        box = c.bbox()
        new_box = pya.DBox(box.left/1000, box.bottom/1000, box.right/2000, box.top/1000)
        lay_view.zoom_box(new_box)
    
        # export image
        res = 2000
        image_file =  export_folder + '\\' + c.name + '.png'
        lay_view.save_image(image_file, res, 8*int(res*(h/w)))
    
    • CommentAuthorMatthias
    • CommentTimeFeb 22nd 2017
     

    Hi nikoh,

    there is one option: add a pseudo-layer to the layer list with the following "layer source":

    !CellFrame #0
    

    Configure this layer with empty stipple and the color you want your cell frame to appear. This will paint a cell frame box plus a label with the cell name, regardless of what hierarchy level you have picked. However, you will always see the label currently. It cannot be disabled.

    Another option is to create a box-type ruler with the cell's bounding box. You can configure this ruler to show a plain line and no labels. Then the ruler acts as a plain box marker. It will be shown in the image too.

    Regards,

    Matthias

    • CommentAuthornikoh
    • CommentTimeFeb 23rd 2017
     
    Hi Matthias,

    thank you very much for your help, I went with the pseudo layer suggestion.

    I would also like to thank you for sacrificing your spare time to provide such great software and support for the community.

    Best wishes,
    nikoh