mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Purge constants from PR #5257.
I'm not sure I agree here, considering that types are dynamic based on schema version.
This commit is contained in:
@@ -33,8 +33,6 @@ from typing import Union
|
|||||||
|
|
||||||
from . import ifcopenshell_wrapper
|
from . import ifcopenshell_wrapper
|
||||||
from .entity_instance import entity_instance
|
from .entity_instance import entity_instance
|
||||||
# from .util.constants import IFC_TYPES
|
|
||||||
from .util.constants import IFC_UNIT_ASSIGNMENT
|
|
||||||
from .util.unit import get_measure_unit_type
|
from .util.unit import get_measure_unit_type
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -743,14 +741,10 @@ class file_units:
|
|||||||
A mapping as dictionary which associates
|
A mapping as dictionary which associates
|
||||||
to basic UnitTypes a unit-entity in the IFC file.
|
to basic UnitTypes a unit-entity in the IFC file.
|
||||||
"""
|
"""
|
||||||
entities = self.by_type(IFC_UNIT_ASSIGNMENT)
|
entities = self.by_type("IfcUnitAssignment")
|
||||||
base = next(iter(entities), None)
|
base = next(iter(entities), None)
|
||||||
units = getattr(base, "Units", None) or ()
|
units = getattr(base, "Units", None) or ()
|
||||||
units_and_types = [
|
units_and_types = [(u, getattr(u, "UnitType", None)) for u in units if isinstance(u, entity_instance)]
|
||||||
(u, getattr(u, "UnitType", None))
|
|
||||||
for u in units
|
|
||||||
if isinstance(u, entity_instance)
|
|
||||||
]
|
|
||||||
self._unit_assignment = {t: u for u, t in units_and_types if isinstance(t, str)}
|
self._unit_assignment = {t: u for u, t in units_and_types if isinstance(t, str)}
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -765,4 +759,4 @@ class file_units:
|
|||||||
Returns the unit entity associated to a measure type
|
Returns the unit entity associated to a measure type
|
||||||
"""
|
"""
|
||||||
t = get_measure_unit_type(t)
|
t = get_measure_unit_type(t)
|
||||||
return self.by_type(t)
|
return self.by_type(t)
|
||||||
|
|||||||
Reference in New Issue
Block a user