diff --git a/src/bonsai/bonsai/bim/module/qto/prop.py b/src/bonsai/bonsai/bim/module/qto/prop.py index 3d9664ec73..0a73240e64 100644 --- a/src/bonsai/bonsai/bim/module/qto/prop.py +++ b/src/bonsai/bonsai/bim/module/qto/prop.py @@ -17,6 +17,7 @@ # along with Bonsai. If not, see . import bpy +import bonsai.tool as tool import ifc5d.qto from bonsai.bim.prop import StrProperty, Attribute from bpy.types import PropertyGroup @@ -33,8 +34,12 @@ from bpy.props import ( def get_qto_rule(self, context): + ifc_file = tool.Ifc.get() + is_ifc4x3 = ifc_file.schema == "IFC4X3" results = [] for rule_id, rule in ifc5d.qto.rules.items(): + if rule_id.startswith("IFC4X3") != is_ifc4x3: + continue results.append((rule_id, rule["name"], rule["description"])) return results diff --git a/src/bonsai/scripts/get_all_qtos.py b/src/bonsai/scripts/get_all_qtos.py index ae0787335d..7f23dca55a 100644 --- a/src/bonsai/scripts/get_all_qtos.py +++ b/src/bonsai/scripts/get_all_qtos.py @@ -1,6 +1,12 @@ +"""Update ifc5d json files with qtos from the provided pset templates path.""" + import json import ifcopenshell.util.pset import ifcopenshell.util.type +import ifc5d +from collections import defaultdict +from pathlib import Path +from typing import Union def order_dict(dictionary): @@ -8,20 +14,110 @@ def order_dict(dictionary): return {k: order_dict(v) if isinstance(v, dict) else v for k, v in sorted(dictionary.items())} -results = {} +PSET_TEMPLATES_FOLDER = Path(ifcopenshell.util.__file__).parent / "schema" +JSON_FOLDER = Path(ifc5d.__file__).parent +QueriesData = dict[str, dict[str, dict[str, Union[str, None]]]] -psetqto = ifcopenshell.util.pset.get_template("IFC4") -for template in psetqto.templates: - for pset_template in template.by_type("IfcPropertySetTemplate"): - if not pset_template.Name.startswith("Qto_"): + +def main() -> None: + # Update IFC4X3 json files from pset templates. + update_json_with_qtos_from_template_file( + JSON_FOLDER / "IFC4X3QtoBaseQuantities.json", PSET_TEMPLATES_FOLDER / "Pset_IFC4X3.ifc" + ) + update_json_with_qtos_from_template_file( + JSON_FOLDER / "IFC4X3QtoBaseQuantitiesBlender.json", PSET_TEMPLATES_FOLDER / "Pset_IFC4X3.ifc" + ) + # Reuse methods defined in IFC4 in IFC4X3 calculators. + reuse_methods_from_other_json_file( + JSON_FOLDER / "IFC4QtoBaseQuantities.json", JSON_FOLDER / "IFC4X3QtoBaseQuantities.json" + ) + reuse_methods_from_other_json_file( + JSON_FOLDER / "IFC4QtoBaseQuantitiesBlender.json", JSON_FOLDER / "IFC4X3QtoBaseQuantitiesBlender.json" + ) + + +def update_json_with_qtos_from_template_file(json_filepath: Path, ifc_filepath: Path) -> None: + """Add missing qtos and properties to the json file from the provided pset template file.""" + qto_templates: dict[str, list[ifcopenshell.entity_instance]] = defaultdict(list) + qto_props: dict[str, set[str]] = defaultdict(set) + ifc_file: ifcopenshell.file + ifc_file = ifcopenshell.open(ifc_filepath) + for template in ifc_file.by_type("IfcPropertySetTemplate"): + template_name = template.Name + if not template_name.startswith("Qto_"): continue - query = pset_template.ApplicableEntity - results.setdefault(query, {}) - results[query].setdefault(pset_template.Name, {}) - for quantity in pset_template.HasPropertyTemplates: - results[query][pset_template.Name][quantity.Name] = None + qto_templates[template_name].append(template) + for prop in template.HasPropertyTemplates: + qto_props[template_name].add(prop.Name) -results = order_dict(results) -print(results) -with open("results.json", "w") as f: - json.dump(results, f, indent=4) + qto_base_quantities_data = json.loads(json_filepath.read_text()) + + calculator_queries_data: QueriesData + added_qtos: set[str] = set() + + for calculator, calculator_queries_data in qto_base_quantities_data["calculators"].items(): + # Gather all supported QTOs. + calculator_supported_qtos: set[str] = set() + for selector_query, query_qtos_data in calculator_queries_data.items(): + for qto_name in query_qtos_data: + calculator_supported_qtos.add(qto_name) + + # Check for missing QTOs. + for template_name in qto_templates: + template = qto_templates[template_name][0] + + applicable_entity_value: str + applicable_entity_value = template.ApplicableEntity + applicable_entities = ifcopenshell.util.pset.parse_applicable_entity(applicable_entity_value) + + selector_query = ifcopenshell.util.pset.convert_applicable_entities_to_query(applicable_entities) + # Add missing selector queries and qtos. + query_qtos_data = calculator_queries_data.setdefault(selector_query, {}) + qto_props_data = query_qtos_data.setdefault(template_name, {}) + + # Add missing properties. + for prop_name in qto_props[template_name]: + if prop_name in qto_props_data: + continue + qto_props_data[prop_name] = None + added_qtos.add(template_name) + + if not added_qtos: + print(f"No Qtos updates for calculator '{calculator}'.") + continue + + # Sort dict alphabetically to keep it looking nice. + # Don't sort the entire json to keep the header structure. + qto_base_quantities_data["calculators"][calculator] = order_dict(calculator_queries_data) + print(f"Added Qtos for {calculator}: {added_qtos}") + json_filepath.write_text(json.dumps(qto_base_quantities_data, indent=4) + "\n") + + +def reuse_methods_from_other_json_file(json_source_filepath: Path, json_target_filepath: Path) -> None: + json_source_data = json.loads(json_source_filepath.read_text()) + json_target_data = json.loads(json_target_filepath.read_text()) + queries_data: QueriesData + queries_data_target: QueriesData + for calculator, queries_data in json_source_data["calculators"].items(): + for selector_query, query_qtos_data in queries_data.items(): + queries_data_target = json_target_data["calculators"][calculator] + # Don't match exactly since queries between IFC4 and IFC4X3 are not in sync currently. + target_query = next((q for q in queries_data_target if q.startswith(selector_query)), None) + if target_query is None: + continue + query_qtos_data_target = queries_data_target[target_query] + for qto_name in query_qtos_data: + if qto_name not in query_qtos_data_target: + continue + props_data = query_qtos_data[qto_name] + props_data_target = query_qtos_data_target[qto_name] + for prop_name in props_data: + if prop_name not in props_data_target: + continue + props_data_target[prop_name] = props_data[prop_name] + + json_target_filepath.write_text(json.dumps(json_target_data, indent=4) + "\n") + + +if __name__ == "__main__": + main() diff --git a/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantities.json b/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantities.json index 2d7e54faab..90e791bce4 100644 --- a/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantities.json +++ b/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantities.json @@ -3,39 +3,39 @@ "description": "This ruleset quantifies every single possible standardised base quantity in IFC4X3 using only IfcOpenShell as a geometry processor.", "calculators": { "IfcOpenShell": { - "IfcActuator": { + "IfcActuator + IfcActuatorType": { "Qto_ActuatorBaseQuantities": { "GrossWeight": null } }, - "IfcAirTerminal": { + "IfcAirTerminal + IfcAirTerminalType": { "Qto_AirTerminalBaseQuantities": { "GrossWeight": null, "Perimeter": null, "TotalSurfaceArea": null } }, - "IfcAirTerminalBox": { + "IfcAirTerminalBox + IfcAirTerminalBoxType": { "Qto_AirTerminalBoxTypeBaseQuantities": { "GrossWeight": null } }, - "IfcAirToAirHeatRecovery": { + "IfcAirToAirHeatRecovery + IfcAirToAirHeatRecoveryType": { "Qto_AirToAirHeatRecoveryBaseQuantities": { "GrossWeight": null } }, - "IfcAlarm": { + "IfcAlarm + IfcAlarmType": { "Qto_AlarmBaseQuantities": { "GrossWeight": null } }, - "IfcAudioVisualAppliance": { + "IfcAudioVisualAppliance + IfcAudioVisualApplianceType": { "Qto_AudioVisualApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcBeam": { + "IfcBeam + IfcBeamType": { "Qto_BeamBaseQuantities": { "CrossSectionArea": null, "GrossSurfaceArea": "gross_get_area", @@ -48,7 +48,7 @@ "OuterSurfaceArea": "net_get_outer_surface_area" } }, - "IfcBoiler": { + "IfcBoiler + IfcBoilerType": { "Qto_BoilerBaseQuantities": { "GrossWeight": null, "NetWeight": null, @@ -58,7 +58,7 @@ "IfcBuilding": { "Qto_BuildingBaseQuantities": { "EavesHeight": null, - "FootprintArea": null, + "FootPrintArea": null, "GrossFloorArea": null, "GrossVolume": null, "Height": null, @@ -66,7 +66,7 @@ "NetVolume": null } }, - "IfcBuildingElementProxy": { + "IfcBuildingElementProxy + IfcBuildingElementProxyType": { "Qto_BuildingElementProxyQuantities": { "NetSurfaceArea": null, "NetVolume": null @@ -79,21 +79,21 @@ "GrossPerimeter": null, "GrossVolume": null, "NetFloorArea": null, - "NetHeigtht": null, + "NetHeight": null, "NetVolume": null } }, - "IfcBurner": { + "IfcBurner + IfcBurnerType": { "Qto_BurnerBaseQuantities": { "GrossWeight": null } }, - "IfcCableCarrierFitting": { + "IfcCableCarrierFitting + IfcCableCarrierFittingType": { "Qto_CableCarrierFittingBaseQuantities": { "GrossWeight": null } }, - "IfcCableCarrierSegment": { + "IfcCableCarrierSegment + IfcCableCarrierSegmentType": { "Qto_CableCarrierSegmentBaseQuantities": { "CrossSectionArea": null, "GrossWeight": null, @@ -101,12 +101,18 @@ "OuterSurfaceArea": null } }, - "IfcCableFitting": { + "IfcCableCarrierSegment, PredefinedType=\"CONDUITSEGMENT\" + IfcCableCarrierSegmentType, PredefinedType=\"CONDUITSEGMENT\"": { + "Qto_ConduitSegmentBaseQuantities": { + "InnerDiameter": null, + "OuterDiameter": null + } + }, + "IfcCableFitting + IfcCableFittingType": { "Qto_CableFittingBaseQuantities": { "GrossWeight": null } }, - "IfcCableSegment": { + "IfcCableSegment + IfcCableSegmentType": { "Qto_CableSegmentBaseQuantities": { "CrossSectionArea": null, "GrossWeight": null, @@ -114,22 +120,22 @@ "OuterSurfaceArea": null } }, - "IfcChiller": { + "IfcChiller + IfcChillerType": { "Qto_ChillerBaseQuantities": { "GrossWeight": null } }, - "IfcChimney": { + "IfcChimney + IfcChimneyType": { "Qto_ChimneyBaseQuantities": { "Length": "net_get_max_xyz" } }, - "IfcCoil": { + "IfcCoil + IfcCoilType": { "Qto_CoilBaseQuantities": { "GrossWeight": null } }, - "IfcColumn": { + "IfcColumn + IfcColumnType": { "Qto_ColumnBaseQuantities": { "CrossSectionArea": null, "GrossSurfaceArea": "gross_get_area", @@ -142,28 +148,28 @@ "OuterSurfaceArea": "net_get_outer_surface_area" } }, - "IfcCommunicationsAppliance": { + "IfcCommunicationsAppliance + IfcCommunicationsApplianceType": { "Qto_CommunicationsApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcCompressor": { + "IfcCompressor + IfcCompressorType": { "Qto_CompressorBaseQuantities": { "GrossWeight": null } }, - "IfcCondenser": { + "IfcCondenser + IfcCondenserType": { "Qto_CondenserBaseQuantities": { "GrossWeight": null } }, - "IfcConstructionEquipmentResource": { + "IfcConstructionEquipmentResource + IfcConstructionEquipmentResourceType": { "Qto_ConstructionEquipmentResourceBaseQuantities": { "OperatingTime": null, "UsageTime": null } }, - "IfcConstructionMaterialResource": { + "IfcConstructionMaterialResource + IfcConstructionMaterialResourceType": { "Qto_ConstructionMaterialResourceBaseQuantities": { "GrossVolume": null, "GrossWeight": null, @@ -171,29 +177,39 @@ "NetWeight": null } }, - "IfcController": { + "IfcController + IfcControllerType": { "Qto_ControllerBaseQuantities": { "GrossWeight": null } }, - "IfcCooledBeam": { + "IfcCooledBeam + IfcCooledBeamType": { "Qto_CooledBeamBaseQuantities": { "GrossWeight": null } }, - "IfcCoolingTower": { + "IfcCoolingTower + IfcCoolingTowerType": { "Qto_CoolingTowerBaseQuantities": { "GrossWeight": null } }, - "IfcCovering": { + "IfcCourse + IfcCourseType": { + "Qto_CourseBaseQuantities": { + "GrossVolume": null, + "Length": null, + "Thickness": null, + "Volume": null, + "Weight": null, + "Width": null + } + }, + "IfcCovering + IfcCoveringType": { "Qto_CoveringBaseQuantities": { "GrossArea": "gross_get_max_side_area", "NetArea": "net_get_max_side_area", "Width": "gross_get_min_xyz" } }, - "IfcCurtainWall": { + "IfcCurtainWall + IfcCurtainWallType": { "Qto_CurtainWallQuantities": { "GrossSideArea": null, "Height": null, @@ -202,20 +218,21 @@ "Width": null } }, - "IfcDamper": { + "IfcDamper + IfcDamperType": { "Qto_DamperBaseQuantities": { "GrossWeight": null } }, - "IfcDistributionChamberElement": { + "IfcDistributionChamberElement + IfcDistributionChamberElementType": { "Qto_DistributionChamberElementBaseQuantities": { + "Depth": null, "GrossSurfaceArea": null, "GrossVolume": null, "NetSurfaceArea": null, "NetVolume": null } }, - "IfcDoor": { + "IfcDoor + IfcDoorType": { "Qto_DoorBaseQuantities": { "Area": null, "Height": null, @@ -223,7 +240,7 @@ "Width": null } }, - "IfcDuctFitting": { + "IfcDuctFitting + IfcDuctFittingType": { "Qto_DuctFittingBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -232,7 +249,7 @@ "OuterSurfaceArea": null } }, - "IfcDuctSegment": { + "IfcDuctSegment + IfcDuctSegmentType": { "Qto_DuctSegmentBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -241,78 +258,106 @@ "OuterSurfaceArea": null } }, - "IfcDuctSilencer": { + "IfcDuctSilencer + IfcDuctSilencerType": { "Qto_DuctSilencerBaseQuantities": { "GrossWeight": null } }, - "IfcElectricAppliance": { + "IfcEarthworksCut": { + "Qto_EarthworksCutBaseQuantities": { + "Depth": null, + "Length": null, + "LooseVolume": null, + "UndisturbedVolume": null, + "Weight": null, + "Width": null + } + }, + "IfcEarthworksFill": { + "Qto_EarthworksFillBaseQuantities": { + "CompactedVolume": null, + "Depth": null, + "Length": null, + "LooseVolume": null, + "Width": null + } + }, + "IfcElectricAppliance + IfcElectricApplianceType": { "Qto_ElectricApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcElectricDistributionBoard": { - "Qto_ElectricDistributionBoardBaseQuantities": { + "IfcElectricDistributionBoard + IfcElectricDistributionBoardType": { + "Qto_DistributionBoardBaseQuantities": { "GrossWeight": null, "NumberOfCircuits": null } }, - "IfcElectricFlowStorageDevice": { + "IfcElectricFlowStorageDevice + IfcElectricFlowStorageDeviceType": { "Qto_ElectricFlowStorageDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcElectricGenerator": { + "IfcElectricGenerator + IfcElectricGeneratorType": { "Qto_ElectricGeneratorBaseQuantities": { "GrossWeight": null } }, - "IfcElectricMotor": { + "IfcElectricMotor + IfcElectricMotorType": { "Qto_ElectricMotorBaseQuantities": { "GrossWeight": null } }, - "IfcElectricTimeControl": { + "IfcElectricTimeControl + IfcElectricTimeControlType": { "Qto_ElectricTimeControlBaseQuantities": { "GrossWeight": null } }, - "IfcEvaporativeCooler": { + "IfcEvaporativeCooler + IfcEvaporativeCoolerType": { "Qto_EvaporativeCoolerBaseQuantities": { "GrossWeight": null } }, - "IfcEvaporator": { + "IfcEvaporator + IfcEvaporatorType": { "Qto_EvaporatorBaseQuantities": { "GrossWeight": null } }, - "IfcFan": { + "IfcFacilityPart": { + "Qto_FacilityPartBaseQuantities": { + "Area": null, + "Height": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcFan + IfcFanType": { "Qto_FanBaseQuantities": { "GrossWeight": null } }, - "IfcFilter": { + "IfcFilter + IfcFilterType": { "Qto_FilterBaseQuantities": { "GrossWeight": null } }, - "IfcFireSuppressionTerminal": { + "IfcFireSuppressionTerminal + IfcFireSuppressionTerminalType": { "Qto_FireSuppressionTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcFlowInstrument": { + "IfcFlowInstrument + IfcFlowInstrumentType": { "Qto_FlowInstrumentBaseQuantities": { "GrossWeight": null } }, - "IfcFlowMeter": { + "IfcFlowMeter + IfcFlowMeterType": { "Qto_FlowMeterBaseQuantities": { "GrossWeight": null } }, - "IfcFooting": { + "IfcFooting + IfcFootingType": { "Qto_FootingBaseQuantities": { "CrossSectionArea": null, "GrossSurfaceArea": null, @@ -326,44 +371,88 @@ "Width": null } }, - "IfcHeatExchanger": { + "IfcGeotechnicalStratum": { + "Qto_ArealStratumBaseQuantities": { + "Area": null, + "Length": null, + "PlanLength": null + }, + "Qto_LinearStratumBaseQuantities": { + "Diameter": null, + "Length": null + }, + "Qto_VolumetricStratumBaseQuantities": { + "Area": null, + "Mass": null, + "PlanArea": null, + "Volume": null + } + }, + "IfcHeatExchanger + IfcHeatExchangerType": { "Qto_HeatExchangerBaseQuantities": { "GrossWeight": null } }, - "IfcHumidifier": { + "IfcHumidifier + IfcHumidifierType": { "Qto_HumidifierBaseQuantities": { "GrossWeight": null } }, - "IfcInterceptor": { + "IfcImpactProtectionDevice + IfcImpactProtectionDeviceType": { + "Qto_ImpactProtectionDeviceBaseQuantities": { + "Weight": null + } + }, + "IfcInterceptor + IfcInterceptorType": { "Qto_InterceptorBaseQuantities": { "GrossWeight": null } }, - "IfcJunctionBox": { + "IfcJunctionBox + IfcJunctionBoxType": { "Qto_JunctionBoxBaseQuantities": { "GrossWeight": null, - "NumberOfGangs": null + "Height": null, + "Length": null, + "NumberOfGangs": null, + "Width": null } }, - "IfcLaborResource": { + "IfcKerb + IfcKerbType": { + "Qto_KerbBaseQuantities": { + "Depth": null, + "Height": null, + "Length": null, + "Volume": null, + "Weight": null, + "Width": null + } + }, + "IfcLaborResource + IfcLaborResourceType": { "Qto_LaborResourceBaseQuantities": { "OvertimeWork": null, "StandardWork": null } }, - "IfcLamp": { + "IfcLamp + IfcLampType": { "Qto_LampBaseQuantities": { "GrossWeight": null } }, - "IfcLightFixture": { + "IfcLightFixture + IfcLightFixtureType": { "Qto_LightFixtureBaseQuantities": { "GrossWeight": null } }, - "IfcMember": { + "IfcMarineFacility": { + "Qto_MarineFacilityBaseQuantities": { + "Area": null, + "Height": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcMember + IfcMemberType": { "Qto_MemberBaseQuantities": { "CrossSectionArea": null, "GrossSurfaceArea": "gross_get_area", @@ -376,7 +465,7 @@ "OuterSurfaceArea": "net_get_outer_surface_area" } }, - "IfcMotorConnection": { + "IfcMotorConnection + IfcMotorConnectionType": { "Qto_MotorConnectionBaseQuantities": { "GrossWeight": null } @@ -390,12 +479,23 @@ "Width": "gross_get_x" } }, - "IfcOutlet": { + "IfcOutlet + IfcOutletType": { "Qto_OutletBaseQuantities": { "GrossWeight": null } }, - "IfcPile": { + "IfcPavement + IfcPavementType": { + "Qto_PavementBaseQuantities": { + "Depth": null, + "GrossArea": null, + "GrossVolume": null, + "Length": null, + "NetArea": null, + "NetVolume": null, + "Width": null + } + }, + "IfcPile + IfcPileType": { "Qto_PileBaseQuantities": { "CrossSectionArea": null, "GrossSurfaceArea": null, @@ -407,7 +507,7 @@ "OuterSurfaceArea": null } }, - "IfcPipeFitting": { + "IfcPipeFitting + IfcPipeFittingType": { "Qto_PipeFittingBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -417,8 +517,9 @@ "OuterSurfaceArea": null } }, - "IfcPipeSegment": { + "IfcPipeSegment + IfcPipeSegmentType": { "Qto_PipeSegmentBaseQuantities": { + "FootPrintArea": null, "GrossCrossSectionArea": null, "GrossWeight": null, "Length": "net_get_segment_length", @@ -427,7 +528,7 @@ "OuterSurfaceArea": null } }, - "IfcPlate": { + "IfcPlate + IfcPlateType": { "Qto_PlateBaseQuantities": { "GrossArea": "gross_get_max_side_area", "GrossVolume": "gross_get_volume", @@ -439,33 +540,50 @@ "Width": "net_get_min_xyz" } }, + "IfcProduct": { + "Qto_BodyGeometryValidation": { + "GrossSurfaceArea": null, + "GrossVolume": null, + "NetSurfaceArea": null, + "NetVolume": null, + "SurfaceGenusAfterFeatures": null, + "SurfaceGenusBeforeFeatures": null + } + }, "IfcProjectionElement": { "Qto_ProjectionElementBaseQuantities": { "Area": null, "Volume": null } }, - "IfcProtectiveDevice": { + "IfcProtectiveDevice + IfcProtectiveDeviceType": { "Qto_ProtectiveDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcProtectiveDeviceTrippingUnit": { + "IfcProtectiveDeviceTrippingUnit + IfcProtectiveDeviceTrippingUnitType": { "Qto_ProtectiveDeviceTrippingUnitBaseQuantities": { "GrossWeight": null } }, - "IfcPump": { + "IfcPump + IfcPumpType": { "Qto_PumpBaseQuantities": { "GrossWeight": null } }, - "IfcRailing": { + "IfcRail + IfcRailType": { + "Qto_RailBaseQuantities": { + "Length": null, + "Volume": null, + "Weight": null + } + }, + "IfcRailing + IfcRailingType": { "Qto_RailingBaseQuantities": { "Length": null } }, - "IfcRampFlight": { + "IfcRampFlight + IfcRampFlightType": { "Qto_RampFlightBaseQuantities": { "GrossArea": null, "GrossVolume": null, @@ -475,37 +593,65 @@ "Width": null } }, - "IfcReinforcingElement": { + "IfcReinforcedSoil": { + "Qto_ReinforcedSoilBaseQuantities": { + "Area": null, + "Depth": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcReinforcingElement + IfcReinforcingElementType": { "Qto_ReinforcingElementBaseQuantities": { "Count": null, "Length": null, "Weight": null } }, - "IfcRoof": { + "IfcRoof + IfcRoofType": { "Qto_RoofBaseQuantities": { "GrossArea": "gross_get_top_area", "NetArea": "net_get_top_area", "ProjectedArea": null } }, - "IfcSanitaryTerminal": { + "IfcSanitaryTerminal + IfcSanitaryTerminalType": { "Qto_SanitaryTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcSensor": { + "IfcSensor + IfcSensorType": { "Qto_SensorBaseQuantities": { "GrossWeight": null } }, + "IfcSign + IfcSignType": { + "Qto_SignBaseQuantities": { + "Height": null, + "Thickness": null, + "Weight": null, + "Width": null + } + }, + "IfcSign, PredefinedType=\"PICTORAL\" + IfcSignType, PredefinedType=\"PICTORAL\"": { + "Qto_PictorialSignQuantities": { + "Area": null, + "SignArea": null + } + }, + "IfcSignal + IfcSignalType": { + "Qto_SignalBaseQuantities": { + "Weight": null + } + }, "IfcSite": { "Qto_SiteBaseQuantities": { "GrossArea": null, "GrossPerimeter": null } }, - "IfcSlab": { + "IfcSlab + IfcSlabType": { "Qto_SlabBaseQuantities": { "Depth": "net_get_z", "GrossArea": "gross_get_footprint_area", @@ -519,13 +665,13 @@ "Width": "net_get_y" } }, - "IfcSolarDevice": { + "IfcSolarDevice + IfcSolarDeviceType": { "Qto_SolarDeviceBaseQuantities": { "GrossArea": null, "GrossWeight": null } }, - "IfcSpace": { + "IfcSpace + IfcSpaceType": { "Qto_SpaceBaseQuantities": { "FinishCeilingHeight": null, "FinishFloorHeight": null, @@ -542,89 +688,116 @@ "NetWallArea": null } }, - "IfcSpaceHeater": { + "IfcSpaceHeater + IfcSpaceHeaterType": { "Qto_SpaceHeaterBaseQuantities": { "GrossWeight": null, "Length": null, "NetWeight": null } }, - "IfcStackTerminal": { + "IfcSpatialZone + IfcSpatialZoneType": { + "Qto_SpatialZoneBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcStackTerminal + IfcStackTerminalType": { "Qto_StackTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcStairFlight": { + "IfcStairFlight + IfcStairFlightType": { "Qto_StairFlightBaseQuantities": { "GrossVolume": null, "Length": "net_get_max_xy", "NetVolume": "net_get_volume" } }, - "IfcSwitchingDevice": { + "IfcSurfaceFeature": { + "Qto_SurfaceFeatureBaseQuantities": { + "Area": null, + "Length": null + } + }, + "IfcSwitchingDevice + IfcSwitchingDeviceType": { "Qto_SwitchingDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcTank": { + "IfcTank + IfcTankType": { "Qto_TankBaseQuantities": { "GrossWeight": null, "NetWeight": null, "TotalSurfaceArea": null } }, - "IfcTransformer": { + "IfcTrackElement, PredefinedType=\"SLEEPER\" + IfcTrackElementType, PredefinedType=\"SLEEPER\"": { + "Qto_SleeperBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcTransformer + IfcTransformerType": { "Qto_TransformerBaseQuantities": { "GrossWeight": null } }, - "IfcTubeBundle": { + "IfcTubeBundle + IfcTubeBundleType": { "Qto_TubeBundleBaseQuantities": { "GrossWeight": null, "NetWeight": null } }, - "IfcUnitaryControlElement": { + "IfcUnitaryControlElement + IfcUnitaryControlElementType": { "Qto_UnitaryControlElementBaseQuantities": { "GrossWeight": null } }, - "IfcUnitaryEquipment": { + "IfcUnitaryEquipment + IfcUnitaryEquipmentType": { "Qto_UnitaryEquipmentBaseQuantities": { "GrossWeight": null } }, - "IfcValve": { + "IfcValve + IfcValveType": { "Qto_ValveBaseQuantities": { "GrossWeight": null } }, - "IfcVibrationIsolator": { + "IfcVehicle, PredefinedType=\"ROLLINGSTOCK\" + IfcVehicle, PredefinedType=\"VEHICLEAIR\" + IfcVehicle, PredefinedType=\"VEHICLEMARINE\" + IfcVehicle, PredefinedType=\"VEHICLE\" + IfcVehicle, PredefinedType=\"VEHICLETRACKED\" + IfcVehicleType, PredefinedType=\"ROLLINGSTOCK\" + IfcVehicleType, PredefinedType=\"VEHICLEAIR\" + IfcVehicleType, PredefinedType=\"VEHICLEMARINE\" + IfcVehicleType, PredefinedType=\"VEHICLE\" + IfcVehicleType, PredefinedType=\"VEHICLETRACKED\"": { + "Qto_VehicleBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcVibrationIsolator + IfcVibrationIsolatorType": { "Qto_VibrationIsolatorBaseQuantities": { "GrossWeight": null } }, - "IfcWall": { + "IfcWall + IfcWallType": { "Qto_WallBaseQuantities": { - "GrossFootprintArea": null, + "GrossFootPrintArea": null, "GrossSideArea": "gross_get_side_area", "GrossVolume": "gross_get_volume", "GrossWeight": null, "Height": "net_get_z", "Length": "net_get_x", - "NetFootprintArea": null, + "NetFootPrintArea": null, "NetSideArea": "net_get_side_area", "NetVolume": "net_get_volume", "NetWeight": null, "Width": "net_get_y" } }, - "IfcWasteTerminal": { + "IfcWasteTerminal + IfcWasteTerminalType": { "Qto_WasteTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcWindow": { + "IfcWindow + IfcWindowType": { "Qto_WindowBaseQuantities": { "Area": "net_get_max_side_area", "Height": "net_get_z", diff --git a/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantitiesBlender.json b/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantitiesBlender.json index f5e7c628de..a1351c07ff 100644 --- a/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantitiesBlender.json +++ b/src/ifc5d/ifc5d/IFC4X3QtoBaseQuantitiesBlender.json @@ -3,39 +3,39 @@ "description": "This ruleset quantifies every single possible standardised base quantity in IFC4X3 using Blender.", "calculators": { "Blender": { - "IfcActuator": { + "IfcActuator + IfcActuatorType": { "Qto_ActuatorBaseQuantities": { "GrossWeight": null } }, - "IfcAirTerminal": { + "IfcAirTerminal + IfcAirTerminalType": { "Qto_AirTerminalBaseQuantities": { "GrossWeight": null, "Perimeter": null, "TotalSurfaceArea": null } }, - "IfcAirTerminalBox": { + "IfcAirTerminalBox + IfcAirTerminalBoxType": { "Qto_AirTerminalBoxTypeBaseQuantities": { "GrossWeight": null } }, - "IfcAirToAirHeatRecovery": { + "IfcAirToAirHeatRecovery + IfcAirToAirHeatRecoveryType": { "Qto_AirToAirHeatRecoveryBaseQuantities": { "GrossWeight": null } }, - "IfcAlarm": { + "IfcAlarm + IfcAlarmType": { "Qto_AlarmBaseQuantities": { "GrossWeight": null } }, - "IfcAudioVisualAppliance": { + "IfcAudioVisualAppliance + IfcAudioVisualApplianceType": { "Qto_AudioVisualApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcBeam": { + "IfcBeam + IfcBeamType": { "Qto_BeamBaseQuantities": { "CrossSectionArea": "get_cross_section_area", "GrossSurfaceArea": "get_gross_surface_area", @@ -48,7 +48,7 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcBoiler": { + "IfcBoiler + IfcBoilerType": { "Qto_BoilerBaseQuantities": { "GrossWeight": null, "NetWeight": null, @@ -58,7 +58,7 @@ "IfcBuilding": { "Qto_BuildingBaseQuantities": { "EavesHeight": null, - "FootprintArea": null, + "FootPrintArea": null, "GrossFloorArea": null, "GrossVolume": null, "Height": null, @@ -66,7 +66,7 @@ "NetVolume": null } }, - "IfcBuildingElementProxy": { + "IfcBuildingElementProxy + IfcBuildingElementProxyType": { "Qto_BuildingElementProxyQuantities": { "NetSurfaceArea": "get_net_surface_area", "NetVolume": "get_net_volume" @@ -79,21 +79,21 @@ "GrossPerimeter": null, "GrossVolume": null, "NetFloorArea": null, - "NetHeigtht": null, + "NetHeight": null, "NetVolume": null } }, - "IfcBurner": { + "IfcBurner + IfcBurnerType": { "Qto_BurnerBaseQuantities": { "GrossWeight": null } }, - "IfcCableCarrierFitting": { + "IfcCableCarrierFitting + IfcCableCarrierFittingType": { "Qto_CableCarrierFittingBaseQuantities": { "GrossWeight": null } }, - "IfcCableCarrierSegment": { + "IfcCableCarrierSegment + IfcCableCarrierSegmentType": { "Qto_CableCarrierSegmentBaseQuantities": { "CrossSectionArea": null, "GrossWeight": null, @@ -101,12 +101,18 @@ "OuterSurfaceArea": null } }, - "IfcCableFitting": { + "IfcCableCarrierSegment, PredefinedType=\"CONDUITSEGMENT\" + IfcCableCarrierSegmentType, PredefinedType=\"CONDUITSEGMENT\"": { + "Qto_ConduitSegmentBaseQuantities": { + "InnerDiameter": null, + "OuterDiameter": null + } + }, + "IfcCableFitting + IfcCableFittingType": { "Qto_CableFittingBaseQuantities": { "GrossWeight": null } }, - "IfcCableSegment": { + "IfcCableSegment + IfcCableSegmentType": { "Qto_CableSegmentBaseQuantities": { "CrossSectionArea": null, "GrossWeight": null, @@ -114,22 +120,22 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcChiller": { + "IfcChiller + IfcChillerType": { "Qto_ChillerBaseQuantities": { "GrossWeight": null } }, - "IfcChimney": { + "IfcChimney + IfcChimneyType": { "Qto_ChimneyBaseQuantities": { "Length": "get_height" } }, - "IfcCoil": { + "IfcCoil + IfcCoilType": { "Qto_CoilBaseQuantities": { "GrossWeight": null } }, - "IfcColumn": { + "IfcColumn + IfcColumnType": { "Qto_ColumnBaseQuantities": { "CrossSectionArea": "get_cross_section_area", "GrossSurfaceArea": "get_gross_surface_area", @@ -142,28 +148,28 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcCommunicationsAppliance": { + "IfcCommunicationsAppliance + IfcCommunicationsApplianceType": { "Qto_CommunicationsApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcCompressor": { + "IfcCompressor + IfcCompressorType": { "Qto_CompressorBaseQuantities": { "GrossWeight": null } }, - "IfcCondenser": { + "IfcCondenser + IfcCondenserType": { "Qto_CondenserBaseQuantities": { "GrossWeight": null } }, - "IfcConstructionEquipmentResource": { + "IfcConstructionEquipmentResource + IfcConstructionEquipmentResourceType": { "Qto_ConstructionEquipmentResourceBaseQuantities": { "OperatingTime": null, "UsageTime": null } }, - "IfcConstructionMaterialResource": { + "IfcConstructionMaterialResource + IfcConstructionMaterialResourceType": { "Qto_ConstructionMaterialResourceBaseQuantities": { "GrossVolume": "get_gross_volume", "GrossWeight": null, @@ -171,29 +177,39 @@ "NetWeight": null } }, - "IfcController": { + "IfcController + IfcControllerType": { "Qto_ControllerBaseQuantities": { "GrossWeight": null } }, - "IfcCooledBeam": { + "IfcCooledBeam + IfcCooledBeamType": { "Qto_CooledBeamBaseQuantities": { "GrossWeight": null } }, - "IfcCoolingTower": { + "IfcCoolingTower + IfcCoolingTowerType": { "Qto_CoolingTowerBaseQuantities": { "GrossWeight": null } }, - "IfcCovering": { + "IfcCourse + IfcCourseType": { + "Qto_CourseBaseQuantities": { + "GrossVolume": null, + "Length": null, + "Thickness": null, + "Volume": null, + "Weight": null, + "Width": null + } + }, + "IfcCovering + IfcCoveringType": { "Qto_CoveringBaseQuantities": { "GrossArea": "get_covering_gross_area", "NetArea": "get_covering_net_area", "Width": "get_covering_width" } }, - "IfcCurtainWall": { + "IfcCurtainWall + IfcCurtainWallType": { "Qto_CurtainWallQuantities": { "GrossSideArea": null, "Height": null, @@ -202,20 +218,21 @@ "Width": null } }, - "IfcDamper": { + "IfcDamper + IfcDamperType": { "Qto_DamperBaseQuantities": { "GrossWeight": null } }, - "IfcDistributionChamberElement": { + "IfcDistributionChamberElement + IfcDistributionChamberElementType": { "Qto_DistributionChamberElementBaseQuantities": { + "Depth": null, "GrossSurfaceArea": "get_gross_surface_area", "GrossVolume": "get_gross_volume", "NetSurfaceArea": "get_net_surface_area", "NetVolume": "get_net_volume" } }, - "IfcDoor": { + "IfcDoor + IfcDoorType": { "Qto_DoorBaseQuantities": { "Area": "get_net_side_area", "Height": "get_height", @@ -223,7 +240,7 @@ "Width": "get_length" } }, - "IfcDuctFitting": { + "IfcDuctFitting + IfcDuctFittingType": { "Qto_DuctFittingBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -232,7 +249,7 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcDuctSegment": { + "IfcDuctSegment + IfcDuctSegmentType": { "Qto_DuctSegmentBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -241,78 +258,106 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcDuctSilencer": { + "IfcDuctSilencer + IfcDuctSilencerType": { "Qto_DuctSilencerBaseQuantities": { "GrossWeight": null } }, - "IfcElectricAppliance": { + "IfcEarthworksCut": { + "Qto_EarthworksCutBaseQuantities": { + "Depth": null, + "Length": null, + "LooseVolume": null, + "UndisturbedVolume": null, + "Weight": null, + "Width": null + } + }, + "IfcEarthworksFill": { + "Qto_EarthworksFillBaseQuantities": { + "CompactedVolume": null, + "Depth": null, + "Length": null, + "LooseVolume": null, + "Width": null + } + }, + "IfcElectricAppliance + IfcElectricApplianceType": { "Qto_ElectricApplianceBaseQuantities": { "GrossWeight": null } }, - "IfcElectricDistributionBoard": { - "Qto_ElectricDistributionBoardBaseQuantities": { + "IfcElectricDistributionBoard + IfcElectricDistributionBoardType": { + "Qto_DistributionBoardBaseQuantities": { "GrossWeight": null, "NumberOfCircuits": null } }, - "IfcElectricFlowStorageDevice": { + "IfcElectricFlowStorageDevice + IfcElectricFlowStorageDeviceType": { "Qto_ElectricFlowStorageDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcElectricGenerator": { + "IfcElectricGenerator + IfcElectricGeneratorType": { "Qto_ElectricGeneratorBaseQuantities": { "GrossWeight": null } }, - "IfcElectricMotor": { + "IfcElectricMotor + IfcElectricMotorType": { "Qto_ElectricMotorBaseQuantities": { "GrossWeight": null } }, - "IfcElectricTimeControl": { + "IfcElectricTimeControl + IfcElectricTimeControlType": { "Qto_ElectricTimeControlBaseQuantities": { "GrossWeight": null } }, - "IfcEvaporativeCooler": { + "IfcEvaporativeCooler + IfcEvaporativeCoolerType": { "Qto_EvaporativeCoolerBaseQuantities": { "GrossWeight": null } }, - "IfcEvaporator": { + "IfcEvaporator + IfcEvaporatorType": { "Qto_EvaporatorBaseQuantities": { "GrossWeight": null } }, - "IfcFan": { + "IfcFacilityPart": { + "Qto_FacilityPartBaseQuantities": { + "Area": null, + "Height": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcFan + IfcFanType": { "Qto_FanBaseQuantities": { "GrossWeight": null } }, - "IfcFilter": { + "IfcFilter + IfcFilterType": { "Qto_FilterBaseQuantities": { "GrossWeight": null } }, - "IfcFireSuppressionTerminal": { + "IfcFireSuppressionTerminal + IfcFireSuppressionTerminalType": { "Qto_FireSuppressionTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcFlowInstrument": { + "IfcFlowInstrument + IfcFlowInstrumentType": { "Qto_FlowInstrumentBaseQuantities": { "GrossWeight": null } }, - "IfcFlowMeter": { + "IfcFlowMeter + IfcFlowMeterType": { "Qto_FlowMeterBaseQuantities": { "GrossWeight": null } }, - "IfcFooting": { + "IfcFooting + IfcFootingType": { "Qto_FootingBaseQuantities": { "CrossSectionArea": "get_cross_section_area", "GrossSurfaceArea": "get_gross_surface_area", @@ -326,44 +371,88 @@ "Width": "get_width" } }, - "IfcHeatExchanger": { + "IfcGeotechnicalStratum": { + "Qto_ArealStratumBaseQuantities": { + "Area": null, + "Length": null, + "PlanLength": null + }, + "Qto_LinearStratumBaseQuantities": { + "Diameter": null, + "Length": null + }, + "Qto_VolumetricStratumBaseQuantities": { + "Area": null, + "Mass": null, + "PlanArea": null, + "Volume": null + } + }, + "IfcHeatExchanger + IfcHeatExchangerType": { "Qto_HeatExchangerBaseQuantities": { "GrossWeight": null } }, - "IfcHumidifier": { + "IfcHumidifier + IfcHumidifierType": { "Qto_HumidifierBaseQuantities": { "GrossWeight": null } }, - "IfcInterceptor": { + "IfcImpactProtectionDevice + IfcImpactProtectionDeviceType": { + "Qto_ImpactProtectionDeviceBaseQuantities": { + "Weight": null + } + }, + "IfcInterceptor + IfcInterceptorType": { "Qto_InterceptorBaseQuantities": { "GrossWeight": null } }, - "IfcJunctionBox": { + "IfcJunctionBox + IfcJunctionBoxType": { "Qto_JunctionBoxBaseQuantities": { "GrossWeight": null, - "NumberOfGangs": null + "Height": null, + "Length": null, + "NumberOfGangs": null, + "Width": null } }, - "IfcLaborResource": { + "IfcKerb + IfcKerbType": { + "Qto_KerbBaseQuantities": { + "Depth": null, + "Height": null, + "Length": null, + "Volume": null, + "Weight": null, + "Width": null + } + }, + "IfcLaborResource + IfcLaborResourceType": { "Qto_LaborResourceBaseQuantities": { "OvertimeWork": null, "StandardWork": null } }, - "IfcLamp": { + "IfcLamp + IfcLampType": { "Qto_LampBaseQuantities": { "GrossWeight": null } }, - "IfcLightFixture": { + "IfcLightFixture + IfcLightFixtureType": { "Qto_LightFixtureBaseQuantities": { "GrossWeight": null } }, - "IfcMember": { + "IfcMarineFacility": { + "Qto_MarineFacilityBaseQuantities": { + "Area": null, + "Height": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcMember + IfcMemberType": { "Qto_MemberBaseQuantities": { "CrossSectionArea": "get_cross_section_area", "GrossSurfaceArea": "get_gross_surface_area", @@ -376,7 +465,7 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcMotorConnection": { + "IfcMotorConnection + IfcMotorConnectionType": { "Qto_MotorConnectionBaseQuantities": { "GrossWeight": null } @@ -390,12 +479,23 @@ "Width": "get_length" } }, - "IfcOutlet": { + "IfcOutlet + IfcOutletType": { "Qto_OutletBaseQuantities": { "GrossWeight": null } }, - "IfcPile": { + "IfcPavement + IfcPavementType": { + "Qto_PavementBaseQuantities": { + "Depth": null, + "GrossArea": null, + "GrossVolume": null, + "Length": null, + "NetArea": null, + "NetVolume": null, + "Width": null + } + }, + "IfcPile + IfcPileType": { "Qto_PileBaseQuantities": { "CrossSectionArea": "get_cross_section_area", "GrossSurfaceArea": "get_gross_surface_area", @@ -407,7 +507,7 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcPipeFitting": { + "IfcPipeFitting + IfcPipeFittingType": { "Qto_PipeFittingBaseQuantities": { "GrossCrossSectionArea": null, "GrossWeight": null, @@ -417,8 +517,9 @@ "OuterSurfaceArea": null } }, - "IfcPipeSegment": { + "IfcPipeSegment + IfcPipeSegmentType": { "Qto_PipeSegmentBaseQuantities": { + "FootPrintArea": null, "GrossCrossSectionArea": null, "GrossWeight": "get_gross_weight", "Length": "get_length", @@ -427,7 +528,7 @@ "OuterSurfaceArea": "get_outer_surface_area" } }, - "IfcPlate": { + "IfcPlate + IfcPlateType": { "Qto_PlateBaseQuantities": { "GrossArea": "get_gross_footprint_area", "GrossVolume": "get_gross_volume", @@ -439,33 +540,50 @@ "Width": "get_height" } }, + "IfcProduct": { + "Qto_BodyGeometryValidation": { + "GrossSurfaceArea": null, + "GrossVolume": null, + "NetSurfaceArea": null, + "NetVolume": null, + "SurfaceGenusAfterFeatures": null, + "SurfaceGenusBeforeFeatures": null + } + }, "IfcProjectionElement": { "Qto_ProjectionElementBaseQuantities": { "Area": "get_net_side_area", "Volume": "get_net_volume" } }, - "IfcProtectiveDevice": { + "IfcProtectiveDevice + IfcProtectiveDeviceType": { "Qto_ProtectiveDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcProtectiveDeviceTrippingUnit": { + "IfcProtectiveDeviceTrippingUnit + IfcProtectiveDeviceTrippingUnitType": { "Qto_ProtectiveDeviceTrippingUnitBaseQuantities": { "GrossWeight": null } }, - "IfcPump": { + "IfcPump + IfcPumpType": { "Qto_PumpBaseQuantities": { "GrossWeight": null } }, - "IfcRailing": { + "IfcRail + IfcRailType": { + "Qto_RailBaseQuantities": { + "Length": null, + "Volume": null, + "Weight": null + } + }, + "IfcRailing + IfcRailingType": { "Qto_RailingBaseQuantities": { "Length": "get_length" } }, - "IfcRampFlight": { + "IfcRampFlight + IfcRampFlightType": { "Qto_RampFlightBaseQuantities": { "GrossArea": "get_gross_stair_area", "GrossVolume": "get_gross_volume", @@ -475,37 +593,65 @@ "Width": "get_width" } }, - "IfcReinforcingElement": { + "IfcReinforcedSoil": { + "Qto_ReinforcedSoilBaseQuantities": { + "Area": null, + "Depth": null, + "Length": null, + "Volume": null, + "Width": null + } + }, + "IfcReinforcingElement + IfcReinforcingElementType": { "Qto_ReinforcingElementBaseQuantities": { "Count": null, "Length": "get_length", "Weight": null } }, - "IfcRoof": { + "IfcRoof + IfcRoofType": { "Qto_RoofBaseQuantities": { "GrossArea": "get_gross_top_area", "NetArea": "get_net_top_area", "ProjectedArea": null } }, - "IfcSanitaryTerminal": { + "IfcSanitaryTerminal + IfcSanitaryTerminalType": { "Qto_SanitaryTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcSensor": { + "IfcSensor + IfcSensorType": { "Qto_SensorBaseQuantities": { "GrossWeight": null } }, + "IfcSign + IfcSignType": { + "Qto_SignBaseQuantities": { + "Height": null, + "Thickness": null, + "Weight": null, + "Width": null + } + }, + "IfcSign, PredefinedType=\"PICTORAL\" + IfcSignType, PredefinedType=\"PICTORAL\"": { + "Qto_PictorialSignQuantities": { + "Area": null, + "SignArea": null + } + }, + "IfcSignal + IfcSignalType": { + "Qto_SignalBaseQuantities": { + "Weight": null + } + }, "IfcSite": { "Qto_SiteBaseQuantities": { "GrossArea": "get_gross_footprint_area", "GrossPerimeter": "get_gross_perimeter" } }, - "IfcSlab": { + "IfcSlab + IfcSlabType": { "Qto_SlabBaseQuantities": { "Depth": "get_height", "GrossArea": "get_gross_footprint_area", @@ -519,13 +665,13 @@ "Width": "get_width" } }, - "IfcSolarDevice": { + "IfcSolarDevice + IfcSolarDeviceType": { "Qto_SolarDeviceBaseQuantities": { "GrossArea": null, "GrossWeight": null } }, - "IfcSpace": { + "IfcSpace + IfcSpaceType": { "Qto_SpaceBaseQuantities": { "FinishCeilingHeight": "get_finish_ceiling_height", "FinishFloorHeight": "get_finish_floor_height", @@ -542,89 +688,116 @@ "NetWallArea": null } }, - "IfcSpaceHeater": { + "IfcSpaceHeater + IfcSpaceHeaterType": { "Qto_SpaceHeaterBaseQuantities": { "GrossWeight": null, "Length": "get_length", "NetWeight": null } }, - "IfcStackTerminal": { + "IfcSpatialZone + IfcSpatialZoneType": { + "Qto_SpatialZoneBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcStackTerminal + IfcStackTerminalType": { "Qto_StackTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcStairFlight": { + "IfcStairFlight + IfcStairFlightType": { "Qto_StairFlightBaseQuantities": { "GrossVolume": "get_gross_volume", "Length": "get_stair_length", "NetVolume": "get_net_volume" } }, - "IfcSwitchingDevice": { + "IfcSurfaceFeature": { + "Qto_SurfaceFeatureBaseQuantities": { + "Area": null, + "Length": null + } + }, + "IfcSwitchingDevice + IfcSwitchingDeviceType": { "Qto_SwitchingDeviceBaseQuantities": { "GrossWeight": null } }, - "IfcTank": { + "IfcTank + IfcTankType": { "Qto_TankBaseQuantities": { "GrossWeight": null, "NetWeight": null, "TotalSurfaceArea": "get_outer_surface_area" } }, - "IfcTransformer": { + "IfcTrackElement, PredefinedType=\"SLEEPER\" + IfcTrackElementType, PredefinedType=\"SLEEPER\"": { + "Qto_SleeperBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcTransformer + IfcTransformerType": { "Qto_TransformerBaseQuantities": { "GrossWeight": null } }, - "IfcTubeBundle": { + "IfcTubeBundle + IfcTubeBundleType": { "Qto_TubeBundleBaseQuantities": { "GrossWeight": null, "NetWeight": null } }, - "IfcUnitaryControlElement": { + "IfcUnitaryControlElement + IfcUnitaryControlElementType": { "Qto_UnitaryControlElementBaseQuantities": { "GrossWeight": null } }, - "IfcUnitaryEquipment": { + "IfcUnitaryEquipment + IfcUnitaryEquipmentType": { "Qto_UnitaryEquipmentBaseQuantities": { "GrossWeight": null } }, - "IfcValve": { + "IfcValve + IfcValveType": { "Qto_ValveBaseQuantities": { "GrossWeight": null } }, - "IfcVibrationIsolator": { + "IfcVehicle, PredefinedType=\"ROLLINGSTOCK\" + IfcVehicle, PredefinedType=\"VEHICLEAIR\" + IfcVehicle, PredefinedType=\"VEHICLEMARINE\" + IfcVehicle, PredefinedType=\"VEHICLE\" + IfcVehicle, PredefinedType=\"VEHICLETRACKED\" + IfcVehicleType, PredefinedType=\"ROLLINGSTOCK\" + IfcVehicleType, PredefinedType=\"VEHICLEAIR\" + IfcVehicleType, PredefinedType=\"VEHICLEMARINE\" + IfcVehicleType, PredefinedType=\"VEHICLE\" + IfcVehicleType, PredefinedType=\"VEHICLETRACKED\"": { + "Qto_VehicleBaseQuantities": { + "Height": null, + "Length": null, + "Width": null + } + }, + "IfcVibrationIsolator + IfcVibrationIsolatorType": { "Qto_VibrationIsolatorBaseQuantities": { "GrossWeight": null } }, - "IfcWall": { + "IfcWall + IfcWallType": { "Qto_WallBaseQuantities": { - "GrossFootprintArea": "get_gross_footprint_area", + "GrossFootPrintArea": null, "GrossSideArea": "get_gross_side_area", "GrossVolume": "get_gross_volume", "GrossWeight": "get_gross_weight", "Height": "get_height", "Length": "get_x", - "NetFootprintArea": "get_net_footprint_area", + "NetFootPrintArea": null, "NetSideArea": "get_net_side_area", "NetVolume": "get_net_volume", "NetWeight": "get_net_weight", "Width": "get_width" } }, - "IfcWasteTerminal": { + "IfcWasteTerminal + IfcWasteTerminalType": { "Qto_WasteTerminalBaseQuantities": { "GrossWeight": null } }, - "IfcWindow": { + "IfcWindow + IfcWindowType": { "Qto_WindowBaseQuantities": { "Area": "get_net_side_area", "Height": "get_height", diff --git a/src/ifc5d/ifc5d/qto.py b/src/ifc5d/ifc5d/qto.py index 2206fe6a1a..3766be8d0d 100644 --- a/src/ifc5d/ifc5d/qto.py +++ b/src/ifc5d/ifc5d/qto.py @@ -35,7 +35,12 @@ from typing import Any, Literal, get_args, Union, Iterable Function = namedtuple("Function", ["measure", "name", "description"]) -RULE_SET = Literal["IFC4QtoBaseQuantities", "IFC4QtoBaseQuantitiesBlender"] +RULE_SET = Literal[ + "IFC4QtoBaseQuantities", + "IFC4QtoBaseQuantitiesBlender", + "IFC4X3QtoBaseQuantities", + "IFC4X3QtoBaseQuantitiesBlender", +] rules: dict[RULE_SET, dict[str, Any]] = {} ResultsDict = dict[ifcopenshell.entity_instance, dict[str, dict[str, float]]] QtosFormulas = dict[str, dict[str, str]] diff --git a/src/ifcopenshell-python/ifcopenshell/util/pset.py b/src/ifcopenshell-python/ifcopenshell/util/pset.py index 08b10996c0..bf90570251 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/pset.py +++ b/src/ifcopenshell-python/ifcopenshell/util/pset.py @@ -24,7 +24,7 @@ import ifcopenshell.util.schema import ifcopenshell.util.type from ifcopenshell.entity_instance import entity_instance from functools import lru_cache -from typing import Optional, Literal +from typing import Optional, Literal, NamedTuple, Union templates: dict[str, "PsetQto"] = {} @@ -111,11 +111,17 @@ class PsetQto: template_type: str = "NOTDEFINED", schema: ifcopenshell.util.schema.IFC_SCHEMA = "IFC4", ) -> bool: - """applicables can have multiple possible patterns : - IfcBoilerType (IfcClass) - IfcBoilerType/STEAM (IfcClass/PREDEFINEDTYPE) - IfcBoilerType[PerformanceHistory] (IfcClass[PerformanceHistory]) - IfcBoilerType/STEAM[PerformanceHistory] (IfcClass/PREDEFINEDTYPE[PerformanceHistory]) + """ + + applicables can have multiple possible patterns : + + .. code-block:: text + + IfcBoilerType (IfcClass) + IfcBoilerType/STEAM (IfcClass/PREDEFINEDTYPE) + IfcBoilerType[PerformanceHistory] (IfcClass[PerformanceHistory]) + IfcBoilerType/STEAM[PerformanceHistory] (IfcClass/PREDEFINEDTYPE[PerformanceHistory]) + """ for applicable in applicables.split(","): match = re.match(r"(\w+)(\[\w+\])*/*(\w+)*(\[\w+\])*", applicable) @@ -194,3 +200,37 @@ def get_pset_template_type(pset_template: entity_instance) -> Literal["PSET", "Q pset_type = next(iter(pset_types)) if len(pset_types) == 1 else None return pset_type + + +class ApplicableEntity(NamedTuple): + value: str + ifc_class: str + predefined_type: Union[str, None] + performance_history: bool + + +def parse_applicable_entity(applicable_entity: str) -> list[ApplicableEntity]: + """Parse ApplicableEntity string query to tuples. + + :param applicable_entity: IfcPropertySetTemplate.ApplicableEntity query. + :return: List of ApplicableEntity tuples. + """ + items: list[ApplicableEntity] = [] + for item in applicable_entity.split(","): + value = item + item, predefined_type = parts if len(parts := item.split("/")) > 1 else (item, None) + ifc_class, performance_history = (parts[0], True) if len(parts := item.split("[")) > 1 else (item, False) + items.append(ApplicableEntity(value, ifc_class, predefined_type, performance_history)) + return items + + +def convert_applicable_entities_to_query(applicable_entities: list[ApplicableEntity]) -> str: + """Get query supported by :func:`ifcopenshell.util.selector.filter_elements`.""" + parts: list[str] = [] + for entity in applicable_entities: + # NOTE: selector currently doesn't support checking if element has performance history. + part = entity.ifc_class + if entity.predefined_type: + part += f', PredefinedType="{entity.predefined_type}"' + parts.append(part) + return " + ".join(parts) diff --git a/src/ifcopenshell-python/test/util/test_pset.py b/src/ifcopenshell-python/test/util/test_pset.py index 90b90f6e35..c99a0b86a6 100644 --- a/src/ifcopenshell-python/test/util/test_pset.py +++ b/src/ifcopenshell-python/test/util/test_pset.py @@ -19,6 +19,7 @@ """Run this test from src/ifcopenshell-python folder: pytest --durations=0 ifcopenshell/util/test_pset.py""" from ifcopenshell.util import pset from ifcopenshell import util +from ifcopenshell.util.pset import ApplicableEntity class TestPsetQto: @@ -66,3 +67,72 @@ class TestPsetQto: assert "Pset_MaterialConcrete" not in names names = self.pset_qto.get_applicable_names("IfcMaterial", "concrete") assert "Pset_MaterialConcrete" in names + + +class TestParseApplicableEntity: + def test_run(self): + assert pset.parse_applicable_entity("IfcBoilerType") == [ + ApplicableEntity("IfcBoilerType", "IfcBoilerType", None, False) + ] + + def test_two_entities(self): + assert pset.parse_applicable_entity("IfcBoilerType,IfcWallType") == [ + ApplicableEntity("IfcBoilerType", "IfcBoilerType", None, False), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + + def test_two_entities_with_performance_history(self): + assert pset.parse_applicable_entity("IfcBoilerType[PerformanceHistory],IfcWallType") == [ + ApplicableEntity("IfcBoilerType[PerformanceHistory]", "IfcBoilerType", None, True), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + + def test_two_entities_with_predefined_type(self): + assert pset.parse_applicable_entity("IfcBoilerType/STEAM,IfcWallType") == [ + ApplicableEntity("IfcBoilerType/STEAM", "IfcBoilerType", "STEAM", False), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + + def test_two_entities_with_predefined_type_and_performance_history(self): + assert pset.parse_applicable_entity("IfcBoilerType[PerformanceHistory]/STEAM,IfcWallType") == [ + ApplicableEntity("IfcBoilerType[PerformanceHistory]/STEAM", "IfcBoilerType", "STEAM", True), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + + +class TestConvertApplicableEntitiesToQuery: + def test_run(self): + entities = [ApplicableEntity("IfcBoilerType", "IfcBoilerType", None, False)] + assert pset.convert_applicable_entities_to_query(entities) == "IfcBoilerType" + + def test_two_entities(self): + entities = [ + ApplicableEntity("IfcBoilerType", "IfcBoilerType", None, False), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + assert pset.convert_applicable_entities_to_query(entities) == "IfcBoilerType + IfcWallType" + + def test_two_entities_with_performance_history(self): + entities = [ + ApplicableEntity("IfcBoilerType[PerformanceHistory]", "IfcBoilerType", None, True), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + assert pset.convert_applicable_entities_to_query(entities) == "IfcBoilerType + IfcWallType" + + def test_two_entities_with_predefined_type(self): + entities = [ + ApplicableEntity("IfcBoilerType/STEAM", "IfcBoilerType", "STEAM", False), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + assert ( + pset.convert_applicable_entities_to_query(entities) == 'IfcBoilerType, PredefinedType="STEAM" + IfcWallType' + ) + + def test_two_entities_with_predefined_type_and_performance_history(self): + entities = [ + ApplicableEntity("IfcBoilerType[PerformanceHistory]/STEAM", "IfcBoilerType", "STEAM", True), + ApplicableEntity("IfcWallType", "IfcWallType", None, False), + ] + assert ( + pset.convert_applicable_entities_to_query(entities) == 'IfcBoilerType, PredefinedType="STEAM" + IfcWallType' + )