Created
February 9, 2017 13:12
-
-
Save farialima/bcd90302e1538a52cdae6acf6687c697 to your computer and use it in GitHub Desktop.
text-based tree view of an IFC file using ifcopenshell (see https://github.com/IndustryFoundationClasses/Questions/issues/11 )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment