mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
New IFC to Brick class mapping utility
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
ifc4_to_brick_map = {}
|
||||||
|
|
||||||
|
with open(os.path.join(cwd, "ifc4_to_brick.json")) as f:
|
||||||
|
ifc4_to_brick_map = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
def get_brick_type(element):
|
||||||
|
predefined_type = getattr(element, "PredefinedType", None)
|
||||||
|
result = None
|
||||||
|
if predefined_type:
|
||||||
|
result = ifc4_to_brick_map.get(f"{element.is_a()}.{predefined_type}", None)
|
||||||
|
if not result:
|
||||||
|
result = ifc4_to_brick_map.get(element.is_a(), None)
|
||||||
|
return result
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"IfcAudioVisualAppliance.CAMERA": "Camera",
|
||||||
|
"IfcUnitaryEquipment.AIRHANDLER": "AHU",
|
||||||
|
"IfcBoiler": "Boiler",
|
||||||
|
"IfcUnitaryEquipment.AIRCONDITIONINGUNIT": "CRAC",
|
||||||
|
"IfcChiller": "Chiller",
|
||||||
|
"IfcCompressor": "Compressor",
|
||||||
|
"IfcCondenser": "Condenser",
|
||||||
|
"IfcCoolingTower": "Cooling_Tower",
|
||||||
|
"IfcDamper": "Damper",
|
||||||
|
"IfcFan": "Fan",
|
||||||
|
"IfcFilter": "Filter",
|
||||||
|
"IfcHeatExchanger": "Heat_Exchanger",
|
||||||
|
"IfcHumidifier": "Humidifier",
|
||||||
|
"IfcPump": "Pump",
|
||||||
|
"IfcAirTerminalBox": "TerminalUnit",
|
||||||
|
"IfcAirTerminalBox.CONSTANTFLOW": "CAV",
|
||||||
|
"IfcAirTerminalBox.VARIABLEFLOWPRESSUREDEPENDANT": "VAV",
|
||||||
|
"IfcAirTerminalBox.VARIABLEFLOWPRESSUREINDEPENDANT": "VAV",
|
||||||
|
"IfcValve": "Valve",
|
||||||
|
"IfcUnitaryControlElement.THERMOSTAT": "Thermostat",
|
||||||
|
"IfcUnitaryControlElement.WEATHERSTATION": "Weather_Station",
|
||||||
|
"IfcLightFixture": "Luminaire",
|
||||||
|
"IfcFlowMeter": "Meter",
|
||||||
|
"IfcFlowMeter.ENERGYMETER": "Electric_Meter",
|
||||||
|
"IfcFlowMeter.GASMETER": "Gas_Meter",
|
||||||
|
"IfcFlowMeter.WATERMETER": "Water_Meter",
|
||||||
|
"IfcElectricMotor": "Motor",
|
||||||
|
"IfcSolarDevice.SOLARPANEL": "PV_Panel",
|
||||||
|
"IfcBuilding": "Building",
|
||||||
|
"IfcBuildingStorey": "Floor",
|
||||||
|
"IfcSpace": "Space",
|
||||||
|
"IfcSpatialZone": "Zone",
|
||||||
|
"IfcSpatialZone.THERMAL": "HVAC_Zone",
|
||||||
|
"IfcSpatialZone.LIGHTING": "Lighting_Zone"
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import pytest
|
||||||
|
import test.bootstrap
|
||||||
|
import ifcopenshell.util.brick as subject
|
||||||
|
|
||||||
|
|
||||||
|
class TestGetBrickTypeIFC4(test.bootstrap.IFC4):
|
||||||
|
def test_run(self):
|
||||||
|
element = self.file.createIfcAirTerminalBox()
|
||||||
|
assert subject.get_brick_type(element) == "TerminalUnit"
|
||||||
|
element.PredefinedType = "CONSTANTFLOW"
|
||||||
|
assert subject.get_brick_type(element) == "CAV"
|
||||||
Reference in New Issue
Block a user