Skip to content

Instantly share code, notes, and snippets.

@farialima
Created February 9, 2017 13:12

Revisions

  1. farialima created this gist Feb 9, 2017.
    17 changes: 17 additions & 0 deletions browse.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    from __future__ import print_function

    import sys
    sys.path.append('ifcopenshell2x3')
    import ifcopenshell
    f = ifcopenshell.open(sys.args[1])

    ids = []
    def visit(inst, indent=''):
    print(indent, inst)
    if inst.id not in ids:
    ids.append(inst.id)
    for child in f.traverse(inst, 1)[1:]: visit(child, indent+' ')
    else:
    print(indent+' ', '...')
    for inst in f:
    visit(inst)