From 00bd159ee752d474be0aa6fdd11765dde5ef2576 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 9 Aug 2023 16:42:03 +1000 Subject: [PATCH] IfcTester JSON reporter now also stores identification data separately for convenient reporting. --- src/ifctester/ifctester/reporter.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ifctester/ifctester/reporter.py b/src/ifctester/ifctester/reporter.py index c3c5bd7abc..ee9e952269 100644 --- a/src/ifctester/ifctester/reporter.py +++ b/src/ifctester/ifctester/reporter.py @@ -21,6 +21,8 @@ import sys import math import logging import datetime +import ifcopenshell +import ifcopenshell.util.element cwd = os.path.dirname(os.path.realpath(__file__)) @@ -189,7 +191,17 @@ class Json(Reporter): def report_failed_entities(self, requirement): return [ - {"reason": requirement.failed_reasons[i], "element": str(e)} + { + "reason": requirement.failed_reasons[i], + "element": str(e), + "class": e.is_a(), + "predefined_type": ifcopenshell.util.element.get_predefined_type(e), + "name": getattr(e, "Name", None), + "description": getattr(e, "Description", None), + "id": e.id(), + "global_id": getattr(e, "GlobalId", None), + "tag": getattr(e, "Tag", None), + } for i, e in enumerate(requirement.failed_entities) ]