From 06685f9768da6a4bb5c8ddbc6d3e4ea2e6703b7b Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 4 Dec 2020 10:59:59 +1100 Subject: [PATCH] Fix example script for printing out properties. See #1145. --- src/ifcopenshell-python/ifcopenshell/geom/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/app.py b/src/ifcopenshell-python/ifcopenshell/geom/app.py index 9490ca3923..8eedc41ec8 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/app.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/app.py @@ -158,9 +158,12 @@ if selection: #get the IfcProduct that is stored in the global variable 'selection' obj = selection for relDefinesByProperties in obj.IsDefinedBy: + if not relDefinesByProperties.is_a("IfcRelDefinesByProperties"): + continue print("[{0}]".format(relDefinesByProperties.RelatingPropertyDefinition.Name)) - for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties: - print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue)) + if relDefinesByProperties.RelatingPropertyDefinition.is_a("IfcPropertySet"): + for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties: + print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue)) print ("\\n") """.lstrip() ),