mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix tests after 7b62b03
Since calculate_unit_scale now requires a project.
def calculate_unit_scale(ifc_file: ifcopenshell.file, unit_type: str = "LENGTHUNIT") -> float:
"""Returns a unit scale factor to convert to and from IFC project units and SI units.
Example:
.. code:: python
ifc_project_length * unit_scale = si_meters
si_meters / unit_scale = ifc_project_length
:param ifc_file: The IFC file.
:param unit_type: The type of SI unit, defaults to "LENGTHUNIT"
:returns: The scale factor
"""
> if not (units := ifc_file.by_type("IfcProject")[0].UnitsInContext):
E IndexError: list index out of range
This commit is contained in:
@@ -115,6 +115,7 @@ class TestAppendAssetIFC2X3(test.bootstrap.IFC2X3):
|
||||
|
||||
def test_append_two_type_products_sharing_the_same_material_indirectly_via_a_material_set(self):
|
||||
library = ifcopenshell.api.project.create_file(version=self.file.schema)
|
||||
ifcopenshell.api.root.create_entity(library, "IfcProject")
|
||||
element1 = ifcopenshell.api.root.create_entity(library, ifc_class="IfcWallType")
|
||||
element2 = ifcopenshell.api.root.create_entity(library, ifc_class="IfcWallType")
|
||||
material = ifcopenshell.api.material.add_material(library, name="Material")
|
||||
|
||||
Reference in New Issue
Block a user