Tree?

I have not been able to find any utility in the menus which
will produce me a hierarchical listing of the layout content.
I have seen other tools produce text reports or display
graphical hierarchy trees.

All I want is to be able to copy & paste text out to a spreadsheet
but my only obvious option is to select and property-query each
one where it sits?

Is there such a function that has escaped my searching?
If yes, toss clue? If no, can it "go on the list"?

Comments

  • Hi dick_freebird,

    This example loop through each cell and check for child cells and print them into a indented string list.

    import pya
    layoutView = pya.Application.instance().main_window().current_view()
    cellView   = layoutView.active_cellview()
    layout     = cellView.layout()
    
    def listTree(layout, cell = None, indent = 4, depth = 0):
        if cell : print (depth * indent * " " + cell.name)
    
        tree       = {}
        cellIDList = list(cell.each_child_cell() if cell else layout.each_top_cell())
    
        for childName in sorted([layout.cell(cellID).name for cellID in cellIDList]):
            if not(childName in tree) : tree[childName] = []
            childCell = layout.cell(childName)
            tree[childName].append(listTree(layout, childCell, indent, depth + 1))
        return tree
    
    listTree(layout)
    
  • Hello,

    I found the script below years ago, don't remember where...
    It adds a menu entry: Tools > Export > Hierarchy To Text
    It opens up in a Browser window...

    Cheers,

    Tomas

Sign In or Register to comment.