From 9a25db6584ce61c57ca0ed5dfdcc57a4ef0b0e74 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Sat, 29 Oct 2022 18:31:40 +0600 Subject: [PATCH] get_attribute_doc get_entity_doc now use recursive method by default --- .../ifcopenshell/util/doc.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/doc.py b/src/ifcopenshell-python/ifcopenshell/util/doc.py index c1881d079a..db0d298a18 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/doc.py +++ b/src/ifcopenshell-python/ifcopenshell/util/doc.py @@ -74,7 +74,7 @@ def get_schema_by_name(version): schema_by_name[version] = ifcopenshell.ifcopenshell_wrapper.schema_by_name(version) return schema_by_name[version] -def get_entity_doc(version, entity_name, recursive=False): +def get_entity_doc(version, entity_name, recursive=True): db = get_db(version) if db: entity = copy.deepcopy(db["entities"].get(entity_name)) @@ -93,7 +93,7 @@ def get_entity_doc(version, entity_name, recursive=False): return entity -def get_attribute_doc(version, entity, attribute, recursive=False): +def get_attribute_doc(version, entity, attribute, recursive=True): db = get_db(version) if db: entity = get_entity_doc(version, entity, recursive) @@ -691,21 +691,13 @@ class DocExtractor: def run_doc_api_examples(): - print("Entities:") + print("Entities (with parent entities attributes included):") print(get_entity_doc("IFC2X3", "IfcWindow")) print(get_entity_doc("IFC4", "IfcWindow")) - print("Entity attributes:") - print(get_attribute_doc("IFC2X3", "IfcActionRequest", "RequestID")) - print(get_attribute_doc("IFC4", "IfcActionRequest", "LongDescription")) - - print("Entities (with parent entities attributes included):") - print(get_entity_doc("IFC2X3", "IfcWindow", recursive=True)) - print(get_entity_doc("IFC4", "IfcWindow", recursive=True)) - print("Entity attributes (with parent entities attributes included):") - print(get_attribute_doc("IFC2X3", "IfcWindow", "OwnerHistory", recursive=True)) - print(get_attribute_doc("IFC4", "IfcWindow", "OwnerHistory", recursive=True)) + print(get_attribute_doc("IFC2X3", "IfcWindow", "OwnerHistory")) + print(get_attribute_doc("IFC4", "IfcWindow", "OwnerHistory")) print("Entity predefined types:") print(get_predefined_type_doc("IFC2X3", "IfcControllerType", "FLOATING"))