Exporting the hierarchy

I would like to obtain a text listing of the layout hierarchy,
just as it appears in the fully expanded "Cells" window
when in not-Flat_List_Mode (I suppose the flat format
has its uses too).

I cannot find in the menus any item that would do this.

Obviously the information already exists right in that
window. But it is not copy-able (Copy wants to select
the cell, not text) or printable-to-file.

Maybe there could be a context-menu addition to
"Copy All" (as displayed, as text) to the system paste
buffer, so the info can be taken between applications?

Comments

  • Yes, sure :)

    But there can also be a (Python) script:

    class TreePrinter(object):
      def __init__(self):
        self.text = ""
      def add(self, text, indent):
        self.text += " " * indent + text + "\n"
      def show(self):
        pya.BrowserDialog("<pre>" + self.text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") + "</pre>").exec_()
    
    def dump_tree(cell, printer, indent):
      printer.add(cell.name, indent)
      child_cells = [ c for c in cell.each_child_cell() ]
      for c in sorted(child_cells, key = lambda c : cell.layout().cell(c).name):
        dump_tree(cell.layout().cell(c), printer, indent + 1)
    
    ly = pya.CellView.active().layout()
    printer = TreePrinter()
    for tc in ly.top_cells():
      dump_tree(tc, printer, 0)
    printer.show()
    

    It opens a browser window from which you can press Ctrl+A to select all and Ctrl+C for copy.

    Best regards,

    Matthias

Sign In or Register to comment.