Skip to content

Instantly share code, notes, and snippets.

@stefkeB
Created October 28, 2022 16:18
Show Gist options
  • Save stefkeB/82dc5abda879e192b26b0f3d3891c665 to your computer and use it in GitHub Desktop.
Save stefkeB/82dc5abda879e192b26b0f3d3891c665 to your computer and use it in GitHub Desktop.
List all materials in an IFC file
import sys
import os
import ifcopenshell
def main():
args = sys.argv
if os.path.isfile(args[1]):
ifc_file = ifcopenshell.open(args[1])
else:
return
print(ifc_file.wrapped_data.header.file_name.name)
materials = ifc_file.by_type('IfcMaterial')
for m in materials:
print(m[0])
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment