* feature_faster_unit_method > main: added constants
* feature_faster_unit_method > main: extended `file` class to dynamically save unit information
* feature_faster_unit_method > main: refactored `get_property_unit` method
1. split out case that returns the wrong type (dictionary of units) into its own method
2. cleaned up (but preserved) logic
3. refactored common part of all cases (the method which prioritises unit then value-entity then measure_class)
---------
Co-authored-by: raj-open <raj-open@users.noreply.github.com>
Co-authored-by: Dion Moult <dion@thinkmoult.com>
Example of the error:
Traceback (most recent call last):
File "\test.py", line 133, in <module>
ifc_file = ifcopenshell.file.from_string(ifc_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\file.py", line 648, in from_string
return file(ifcopenshell_wrapper.read(s))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\file.py", line 264, in __init__
raise exc(msg)
ifcopenshell.SchemaError: Unsupported schema: IFC2X3
Exception ignored in: <function file.__del__ at 0x00000250896EB740>
Traceback (most recent call last):
File "\ifcopenshell\file.py", line 282, in __del__
del file_dict[self.file_pointer()]
^^^^^^^^^^^^^^^^^
File "\ifcopenshell\file.py", line 424, in __getattr__
return getattr(self.wrapped_data, attr)
^^^^^^^^^^^^^^^^^
File "\ifcopenshell\file.py", line 424, in __getattr__
return getattr(self.wrapped_data, attr)
^^^^^^^^^^^^^^^^^
File "\ifcopenshell\file.py", line 424, in __getattr__
return getattr(self.wrapped_data, attr)
^^^^^^^^^^^^^^^^^
[Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded
Simple way to trigger those recursions was:
import ifcopenshell
ifcopenshell.file(schema="IFC4x3_RC4_43c3555")
ifcopenshell.entity_instance(("IFC4X3", "IfcPresentationStyleAssignment"))