diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index 1b827fda09..f23d64d933 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -97,10 +97,19 @@ def open(path: "os.PathLike | str", format: str = None, should_stream: bool = Fa You can specify a file format. If no format is given, it is guessed from its extension. Currently supported specified format : .ifc | .ifcZIP | .ifcXML - Examples: + You can then filter by element ID, class, etc, and subscript by id or guid. + + Example: + + .. code:: python + model = ifcopenshell.open("/path/to/model.ifc") model = ifcopenshell.open("/path/to/model.ifcXML") model = ifcopenshell.open("/path/to/model.any_extension", ".ifc") + + products = model.by_type("IfcProduct") + print(products[0].id(), products[0].GlobalId) # 122 2XQ$n5SLP5MBLyL442paFx + print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True """ path = Path(path) if format is None: diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index e407afb865..f879d4eeea 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -191,10 +191,10 @@ class file(object): .. code:: python - ifc_file = ifcopenshell.open(file_path) - products = ifc_file.by_type("IfcProduct") + model = ifcopenshell.open(file_path) + products = model.by_type("IfcProduct") print(products[0].id(), products[0].GlobalId) # 122 2XQ$n5SLP5MBLyL442paFx - print(products[0] == ifc_file[122] == ifc_file["2XQ$n5SLP5MBLyL442paFx"]) # True + print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True """ wrapped_data: ifcopenshell_wrapper.file @@ -244,7 +244,7 @@ class file(object): prefixes = ("IFC", "X", "_ADD", "_TC") schema = "".join("".join(map(str, t)) if t[1] else "" for t in zip(prefixes, schema_version)) else: - schema = {"IFC4X3": "IFC4X3_ADD1"}.get(schema, schema) + schema = {"IFC4X3": "IFC4X3_ADD2"}.get(schema, schema) if f is not None: self.wrapped_data = f else: