Ifc4x3 - entity-types mapping

- added mapping entity-types mapping based on iso release of ifc4x3

- added some manual corrections for `generate_util_type_json.py` if someone would regenerate the map for ifc4.

- manual correction in ifc4x3 mapping for IfcCivilElement. It could be removed in the future releases of IFC if https://github.com/buildingSMART/IFC4.3.x-development/issues/583 is resolved

If curious to look what were the changes for mapping between ifc4 and ifc4x3:
https://github.com/IfcOpenShell/IfcOpenShell/commit/da51253fb0a9d08aa93f5fe3c074d3592b3aa997#diff-98f525c91bb47b9820e603fba61cc015d3e6ae7261593d727c51114e3ff73aa7
This commit is contained in:
Andrej730
2023-02-17 15:29:10 +05:00
parent 743bd2c48f
commit d52618277e
3 changed files with 506 additions and 90 deletions
@@ -0,0 +1,380 @@
{
"IfcActuator": [
"IfcActuatorType"
],
"IfcAirTerminal": [
"IfcAirTerminalType"
],
"IfcAirTerminalBox": [
"IfcAirTerminalBoxType"
],
"IfcAirToAirHeatRecovery": [
"IfcAirToAirHeatRecoveryType"
],
"IfcAlarm": [
"IfcAlarmType"
],
"IfcAudioVisualAppliance": [
"IfcAudioVisualApplianceType"
],
"IfcBeam": [
"IfcBeamType"
],
"IfcBearing": [
"IfcBearingType"
],
"IfcBoiler": [
"IfcBoilerType"
],
"IfcBuildingElementPart": [
"IfcBuildingElementPartType"
],
"IfcBuildingElementProxy": [
"IfcBuildingElementProxyType"
],
"IfcBurner": [
"IfcBurnerType"
],
"IfcCableCarrierFitting": [
"IfcCableCarrierFittingType"
],
"IfcCableCarrierSegment": [
"IfcCableCarrierSegmentType"
],
"IfcCableFitting": [
"IfcCableFittingType"
],
"IfcCableSegment": [
"IfcCableSegmentType"
],
"IfcCaissonFoundation": [
"IfcCaissonFoundationType"
],
"IfcChiller": [
"IfcChillerType"
],
"IfcChimney": [
"IfcChimneyType"
],
"IfcCoil": [
"IfcCoilType"
],
"IfcColumn": [
"IfcColumnType"
],
"IfcCommunicationsAppliance": [
"IfcCommunicationsApplianceType"
],
"IfcCompressor": [
"IfcCompressorType"
],
"IfcCondenser": [
"IfcCondenserType"
],
"IfcController": [
"IfcControllerType"
],
"IfcConveyorSegment": [
"IfcConveyorSegmentType"
],
"IfcCooledBeam": [
"IfcCooledBeamType"
],
"IfcCoolingTower": [
"IfcCoolingTowerType"
],
"IfcCourse": [
"IfcCourseType"
],
"IfcCovering": [
"IfcCoveringType"
],
"IfcCurtainWall": [
"IfcCurtainWallType"
],
"IfcDamper": [
"IfcDamperType"
],
"IfcDeepFoundation": [
"IfcDeepFoundationType"
],
"IfcDiscreteAccessory": [
"IfcDiscreteAccessoryType"
],
"IfcDistributionBoard": [
"IfcDistributionBoardType"
],
"IfcDistributionChamberElement": [
"IfcDistributionChamberElementType"
],
"IfcDoor": [
"IfcDoorType"
],
"IfcDuctFitting": [
"IfcDuctFittingType"
],
"IfcDuctSegment": [
"IfcDuctSegmentType"
],
"IfcDuctSilencer": [
"IfcDuctSilencerType"
],
"IfcElectricAppliance": [
"IfcElectricApplianceType"
],
"IfcElectricDistributionBoard": [
"IfcElectricDistributionBoardType"
],
"IfcElectricFlowStorageDevice": [
"IfcElectricFlowStorageDeviceType"
],
"IfcElectricFlowTreatmentDevice": [
"IfcElectricFlowTreatmentDeviceType"
],
"IfcElectricGenerator": [
"IfcElectricGeneratorType"
],
"IfcElectricMotor": [
"IfcElectricMotorType"
],
"IfcElectricTimeControl": [
"IfcElectricTimeControlType"
],
"IfcElementAssembly": [
"IfcElementAssemblyType"
],
"IfcEngine": [
"IfcEngineType"
],
"IfcEvaporativeCooler": [
"IfcEvaporativeCoolerType"
],
"IfcEvaporator": [
"IfcEvaporatorType"
],
"IfcFan": [
"IfcFanType"
],
"IfcFastener": [
"IfcFastenerType"
],
"IfcFilter": [
"IfcFilterType"
],
"IfcFireSuppressionTerminal": [
"IfcFireSuppressionTerminalType"
],
"IfcFlowInstrument": [
"IfcFlowInstrumentType"
],
"IfcFlowMeter": [
"IfcFlowMeterType"
],
"IfcFooting": [
"IfcFootingType"
],
"IfcFurniture": [
"IfcFurnitureType"
],
"IfcGeographicElement": [
"IfcGeographicElementType"
],
"IfcHeatExchanger": [
"IfcHeatExchangerType"
],
"IfcHumidifier": [
"IfcHumidifierType"
],
"IfcImpactProtectionDevice": [
"IfcImpactProtectionDeviceType"
],
"IfcInterceptor": [
"IfcInterceptorType"
],
"IfcJunctionBox": [
"IfcJunctionBoxType"
],
"IfcKerb": [
"IfcKerbType"
],
"IfcLamp": [
"IfcLampType"
],
"IfcLightFixture": [
"IfcLightFixtureType"
],
"IfcLiquidTerminal": [
"IfcLiquidTerminalType"
],
"IfcMechanicalFastener": [
"IfcMechanicalFastenerType"
],
"IfcMedicalDevice": [
"IfcMedicalDeviceType"
],
"IfcMember": [
"IfcMemberType"
],
"IfcMobileTelecommunicationsAppliance": [
"IfcMobileTelecommunicationsApplianceType"
],
"IfcMooringDevice": [
"IfcMooringDeviceType"
],
"IfcMotorConnection": [
"IfcMotorConnectionType"
],
"IfcNavigationElement": [
"IfcNavigationElementType"
],
"IfcOutlet": [
"IfcOutletType"
],
"IfcPavement": [
"IfcPavementType"
],
"IfcPile": [
"IfcPileType"
],
"IfcPipeFitting": [
"IfcPipeFittingType"
],
"IfcPipeSegment": [
"IfcPipeSegmentType"
],
"IfcPlate": [
"IfcPlateType"
],
"IfcProtectiveDevice": [
"IfcProtectiveDeviceType"
],
"IfcProtectiveDeviceTrippingUnit": [
"IfcProtectiveDeviceTrippingUnitType"
],
"IfcPump": [
"IfcPumpType"
],
"IfcRail": [
"IfcRailType"
],
"IfcRailing": [
"IfcRailingType"
],
"IfcRamp": [
"IfcRampType"
],
"IfcRampFlight": [
"IfcRampFlightType"
],
"IfcReinforcingBar": [
"IfcReinforcingBarType"
],
"IfcReinforcingMesh": [
"IfcReinforcingMeshType"
],
"IfcRoof": [
"IfcRoofType"
],
"IfcSanitaryTerminal": [
"IfcSanitaryTerminalType"
],
"IfcSensor": [
"IfcSensorType"
],
"IfcShadingDevice": [
"IfcShadingDeviceType"
],
"IfcSign": [
"IfcSignType"
],
"IfcSignal": [
"IfcSignalType"
],
"IfcSlab": [
"IfcSlabType"
],
"IfcSolarDevice": [
"IfcSolarDeviceType"
],
"IfcSpace": [
"IfcSpaceType"
],
"IfcSpaceHeater": [
"IfcSpaceHeaterType"
],
"IfcSpatialZone": [
"IfcSpatialZoneType"
],
"IfcStackTerminal": [
"IfcStackTerminalType"
],
"IfcStair": [
"IfcStairType"
],
"IfcStairFlight": [
"IfcStairFlightType"
],
"IfcSwitchingDevice": [
"IfcSwitchingDeviceType"
],
"IfcSystemFurnitureElement": [
"IfcSystemFurnitureElementType"
],
"IfcTank": [
"IfcTankType"
],
"IfcTendon": [
"IfcTendonType"
],
"IfcTendonAnchor": [
"IfcTendonAnchorType"
],
"IfcTendonConduit": [
"IfcTendonConduitType"
],
"IfcTrackElement": [
"IfcTrackElementType"
],
"IfcTransformer": [
"IfcTransformerType"
],
"IfcTransportElement": [
"IfcTransportElementType"
],
"IfcTubeBundle": [
"IfcTubeBundleType"
],
"IfcUnitaryControlElement": [
"IfcUnitaryControlElementType"
],
"IfcUnitaryEquipment": [
"IfcUnitaryEquipmentType"
],
"IfcValve": [
"IfcValveType"
],
"IfcVehicle": [
"IfcVehicleType"
],
"IfcVibrationDamper": [
"IfcVibrationDamperType"
],
"IfcVibrationIsolator": [
"IfcVibrationIsolatorType"
],
"IfcWall": [
"IfcWallType"
],
"IfcWasteTerminal": [
"IfcWasteTerminalType"
],
"IfcWindow": [
"IfcWindowType"
],
"IfcCivilElement": [
"IfcCivilElementType"
],
"IfcWallStandardCase": [
"IfcWallType"
]
}
@@ -1,5 +1,5 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
# Copyright (C) 2021, 2023 Dion Moult <dion@thinkmoult.com>, @Andrej730
#
# This file is part of IfcOpenShell.
#
@@ -24,28 +24,35 @@ cwd = os.path.dirname(os.path.realpath(__file__))
entity_to_type_map = {}
type_to_entity_map = {}
with open(os.path.join(cwd, "entity_to_type_map_2x3.json")) as f:
entity_to_type_map["IFC2X3"] = json.load(f)
mapped_schemas = {
"IFC2X3": "entity_to_type_map_2x3.json",
"IFC4": "entity_to_type_map_4.json",
"IFC4x3": "entity_to_type_map_4x3.json",
}
for schema in mapped_schemas:
# load entity maps from json
schema_path = os.path.join(cwd, mapped_schemas[schema])
with open(schema_path) as f:
entity_to_type_map[schema] = json.load(f)
with open(os.path.join(cwd, "entity_to_type_map_4.json")) as f:
entity_to_type_map["IFC4"] = json.load(f)
for schema in ["IFC2X3", "IFC4"]:
# create type_to_entity map
type_to_entity_map[schema] = {}
for element, element_types in entity_to_type_map[schema].items():
for element_type in element_types:
type_to_entity_map[schema].setdefault(element_type, []).append(element)
if schema == "IFC2X3":
# There is no official mapping for IFC2X3 but this method gets us something that looks correct
for element_type, elements in type_to_entity_map[schema].items():
guessed_element = element_type[0:-len("Type")]
# need to take both Type (4 symbols) and Style (5 symbols) into account
guessed_element = element_type[:-5] if element_type.endswith("Style") else element_type[:-4]
if guessed_element in elements:
type_to_entity_map[schema][element_type] = [e for e in elements if guessed_element in e]
def get_applicable_types(ifc_class, schema="IFC4"):
return entity_to_type_map[schema].get(ifc_class, [])
return entity_to_type_map[schema.upper()].get(ifc_class, [])
def get_applicable_entities(ifc_type_class, schema="IFC4"):
return type_to_entity_map[schema].get(ifc_type_class, [])
return type_to_entity_map[schema.upper()].get(ifc_type_class, [])