Files
IFC-Exporter-Rhino/utils/mapper.py
T
NLSA 06b66145b6
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
rhino - ifc export first update
2026-03-23 12:43:44 +01:00

22 lines
735 B
Python

# =============================================================================
# mapper.py
# Maps Speckle objects → IFC entity classes.
#
# Reads the IFC class from _properties.Attributes.type
# Falls back to IfcBuildingElementProxy if not present.
# =============================================================================
from utils.properties import get_attributes
def classify(obj) -> str:
"""
Determine the IFC class for a Speckle object.
Reads from _properties.Attributes.type. Falls back to IfcBuildingElementProxy.
"""
attrs = get_attributes(obj)
ifc_type = attrs.get("type")
if ifc_type and isinstance(ifc_type, str):
return ifc_type.strip()
return "IfcBuildingElementProxy"