Migrate calculator to qto module and mapper to Ifc5D.

This commit is contained in:
Dion Moult
2024-05-29 12:45:09 +10:00
parent 9001aa6383
commit 1bda47f76e
8 changed files with 1864 additions and 1861 deletions
@@ -1,579 +0,0 @@
mapper = {
'Qto_AudioVisualApplianceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_PlateBaseQuantities' : {
'Width' : "get_height",
'Perimeter' : "get_gross_perimeter",
'GrossArea' : "get_gross_footprint_area",
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_OpeningElementBaseQuantities' : {
'Width' : "get_length",
'Height' : "get_opening_height",
'Depth' : "get_opening_depth",
'Area' : "get_opening_mapping_area",
'Volume' : "get_net_volume",
},
'Qto_MarineFacilityBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'Area' : "get_net_footprint_area",
'Volume' : "get_net_volume",
},
'Qto_ChillerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_PileBaseQuantities' : {
'Length' : "get_length",
'CrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_VibrationIsolatorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_LampBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_VehicleBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
},
'Qto_PipeFittingBaseQuantities' : {
'Length' : None,
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : None,
'OuterSurfaceArea' : None,
'GrossWeight' : None,
'NetWeight' : None,
},
'Qto_CableCarrierFittingBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_HeatExchangerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_DoorBaseQuantities' : {
'Width' : { "function_name" : "get_length", "args" : ", main_axis = 'x'"},
'Height' : "get_height",
'Perimeter' : "get_rectangular_perimeter",
'Area' : "get_net_side_area",
},
'Qto_DuctSegmentBaseQuantities' : {
'Length' : "get_length",
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : None,
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossWeight' : None,
},
'Qto_TransformerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_FacilityPartBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'Area' : "get_net_footprint_area",
'Volume' : "get_net_volume",
},
'Qto_ProjectionElementBaseQuantities' : {
'Area' : "get_net_side_area",
'Volume' : "get_net_volume",
},
'Qto_SignBaseQuantities' : {
'Height' : "get_height",
'Width' : { "function_name" : "get_length", "args" : ", main_axis = 'x'"},
'Thickness' : "get_width",
'Weight' : None,
},
'Qto_CableSegmentBaseQuantities' : {
'GrossWeight' : None,
'Length' : "get_length",
'CrossSectionArea' : None,
'OuterSurfaceArea' : "get_outer_surface_area",
},
'Qto_BuildingBaseQuantities' : {
'Height' : None,
'EavesHeight' : None,
'FootPrintArea' : None,
'GrossFloorArea' : None,
'NetFloorArea' : None,
'GrossVolume' : None,
'NetVolume' : None,
},
'Qto_ElectricFlowStorageDeviceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CommunicationsApplianceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_RailBaseQuantities' : {
'Length' : "get_length",
'Volume' : "get_net_volume",
'Weight' : "get_net_weight",
},
'Qto_PictorialSignQuantities' : {
'Area' : "get_net_side_area",
'SignArea' : None,
},
'Qto_SpaceHeaterBaseQuantities' : {
'Length' : "get_length",
'GrossWeight' : None,
'NetWeight' : None,
},
'Qto_CoveringBaseQuantities' : {
'Width' : "get_covering_width",
'GrossArea' : "get_covering_gross_area",
'NetArea' : "get_covering_net_area",
},
'Qto_PipeSegmentBaseQuantities' : {
'Length' : "get_length",
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_HumidifierBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ConstructionEquipmentResourceBaseQuantities' : {
'UsageTime' : None,
'OperatingTime' : None,
},
'Qto_AlarmBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_JunctionBoxBaseQuantities' : {
'GrossWeight' : None,
'NumberOfGangs' : None,
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
},
'Qto_ArealStratumBaseQuantities' : {
'Area' : "get_net_footprint_area",
'Length' : "get_length",
'PlanLength' : None,
},
'Qto_SiteBaseQuantities' : {
'GrossPerimeter' : "get_gross_perimeter",
'GrossArea' : "get_gross_footprint_area",
},
'Qto_MotorConnectionBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_RoofBaseQuantities' : {
'GrossArea' : "get_gross_top_area",
'NetArea' : "get_net_top_area",
'ProjectedArea' : None,
},
'Qto_ChimneyBaseQuantities' : {
'Length' : "get_height",
},
'Qto_ElectricTimeControlBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ElectricMotorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_EarthworksFillBaseQuantities' : {
'Length' : None,
'Width' : None,
'Depth' : None,
'CompactedVolume' : None,
'LooseVolume' : None,
},
'Qto_ConduitSegmentBaseQuantities' : {
'InnerDiameter' : None,
'OuterDiameter' : None,
},
'Qto_SignalBaseQuantities' : {
'Weight' : None,
},
'Qto_DuctFittingBaseQuantities' : {
'Length' : "get_length",
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : None,
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossWeight' : None,
},
'Qto_UnitaryControlElementBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ActuatorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CurtainWallQuantities' : {
'Length' : None,
'Height' : None,
'Width' : None,
'GrossSideArea' : None,
'NetSideArea' : None,
},
'Qto_BoilerBaseQuantities' : {
'GrossWeight' : None,
'NetWeight' : None,
'TotalSurfaceArea' : None,
},
'Qto_FlowMeterBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_AirTerminalBaseQuantities' : {
'GrossWeight' : None,
'Perimeter' : None,
'TotalSurfaceArea' : None,
},
'Qto_DuctSilencerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_WasteTerminalBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_SlabBaseQuantities' : {
'Width' : "get_width",
'Length' : "get_length",
'Depth' : "get_height",
'Perimeter' : "get_gross_perimeter",
'GrossArea' : "get_gross_footprint_area",
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_ImpactProtectionDeviceBaseQuantities' : {
'Weight' : None,
},
'Qto_LightFixtureBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_FlowInstrumentBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_BuildingStoreyBaseQuantities' : {
'GrossHeight' : None,
'NetHeight' : None,
'GrossPerimeter' : None,
'GrossFloorArea' : None,
'NetFloorArea' : None,
'GrossVolume' : None,
'NetVolume' : None,
},
'Qto_ReinforcedSoilBaseQuantities' : {
'Length' : None,
'Width' : None,
'Depth' : None,
'Area' : None,
'Volume' : None,
},
'Qto_DistributionBoardBaseQuantities' : {
'GrossWeight' : None,
'NumberOfCircuits' : None,
},
'Qto_FootingBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'CrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_PumpBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CableCarrierSegmentBaseQuantities' : {
'GrossWeight' : None,
'Length' : None,
'CrossSectionArea' : None,
'OuterSurfaceArea' : None,
},
'Qto_InterceptorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ColumnBaseQuantities' : {
'Length' : "get_length",
'CrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_EarthworksCutBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Depth' : "get_height",
'UndisturbedVolume' : "get_net_volume",
'LooseVolume' : None,
'Weight' : None,
},
'Qto_StackTerminalBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CoilBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_KerbBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'Depth' : None,
'Volume' : "get_net_volume",
'Weight' : None,
},
'Qto_PavementBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Depth' : "get_height",
'GrossArea' : "get_gross_footprint_area",
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
},
'Qto_ControllerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_SolarDeviceBaseQuantities' : {
'GrossWeight' : None,
'GrossArea' : None,
},
'Qto_RampFlightBaseQuantities' : {
'Length' : "get_stair_length",
'Width' : "get_width",
'GrossArea' : "get_gross_stair_area",
'NetArea' : "get_net_stair_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
},
'Qto_ElectricApplianceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ValveBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_DamperBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_SurfaceFeatureBaseQuantities' : {
'Area' : "get_net_footprint_area",
'Length' : "get_length",
},
'Qto_WallBaseQuantities' : {
'Length' : { "function_name" : "get_length", "args" : ", main_axis = 'x'"},
'Width' : "get_width",
'Height' : "get_height",
'GrossFootprintArea' : "get_gross_footprint_area",
'NetFootprintArea' : "get_net_footprint_area",
'GrossSideArea' : "get_gross_side_area",
'NetSideArea' : "get_net_side_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_StairFlightBaseQuantities' : {
'Length' : "get_stair_length",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
},
'Qto_SwitchingDeviceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_BurnerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ConstructionMaterialResourceBaseQuantities' : {
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
},
'Qto_ElectricGeneratorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_LinearStratumBaseQuantities' : {
'Diameter' : None,
'Length' : None,
},
'Qto_CableFittingBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_DistributionChamberElementBaseQuantities' : {
'GrossSurfaceArea' : "get_gross_surface_area",
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'Depth' : "get_length",
},
'Qto_CompressorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_ProtectiveDeviceTrippingUnitBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_EvaporatorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_SpaceBaseQuantities' : {
'Height' : "get_height",
'FinishCeilingHeight' : "get_finish_ceiling_height",
'FinishFloorHeight' : "get_finish_floor_height",
'GrossPerimeter' : "get_gross_perimeter",
'NetPerimeter' : None,
'GrossFloorArea' : "get_gross_footprint_area",
'NetFloorArea' : "get_net_floor_area",
'GrossWallArea' : None,
'NetWallArea' : None,
'GrossCeilingArea' : "get_gross_ceiling_area",
'NetCeilingArea' : "get_net_ceiling_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_space_net_volume",
},
'Qto_CourseBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Thickness' : "get_height",
'Volume' : "get_net_volume",
'GrossVolume' : "get_gross_volume",
'Weight' : None,
},
'Qto_CondenserBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_FireSuppressionTerminalBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_RailingBaseQuantities' : {
'Length' : "get_length",
},
'Qto_TubeBundleBaseQuantities' : {
'GrossWeight' : None,
'NetWeight' : None,
},
'Qto_BeamBaseQuantities' : {
'Length' : "get_length",
'CrossSectionArea' : "get_cross_section_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_SleeperBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
},
'Qto_ProtectiveDeviceBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CooledBeamBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_TankBaseQuantities' : {
'GrossWeight' : None,
'NetWeight' : None,
'TotalSurfaceArea' : "get_outer_surface_area",
},
'Qto_AirToAirHeatRecoveryBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_CoolingTowerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_SensorBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_WindowBaseQuantities' : {
'Width' : { "function_name" : "get_length", "args" : ", main_axis = 'x'"},
'Height' : "get_height",
'Perimeter' : "get_rectangular_perimeter",
'Area' : "get_net_side_area",
},
'Qto_SanitaryTerminalBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_BuildingElementProxyQuantities' : {
'NetSurfaceArea' : "get_net_surface_area",
'NetVolume' : "get_net_volume",
},
'Qto_FanBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_OutletBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_UnitaryEquipmentBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_FilterBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_MemberBaseQuantities' : {
'Length' : "get_length",
'CrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_BodyGeometryValidation' : {
'GrossSurfaceArea' : "get_gross_surface_area",
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'SurfaceGenusBeforeFeatures' : None,
'SurfaceGenusAfterFeatures' : None,
},
'Qto_VolumetricStratumBaseQuantities' : {
'Area' : "get_net_footprint_area",
'Mass' : None,
'PlanArea' : "get_net_footprint_area",
'Volume' : "get_net_volume",
},
'Qto_SpatialZoneBaseQuantities' : {
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
},
'Qto_ReinforcingElementBaseQuantities' : {
'Count' : None,
'Length' : "get_length",
'Weight' : None,
},
'Qto_EvaporativeCoolerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_AirTerminalBoxTypeBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_LaborResourceBaseQuantities' : {
'StandardWork' : None,
'OvertimeWork' : None,
},
}
mapper["EQto_BodyGeometryValidation"] = mapper["Qto_BodyGeometryValidation"]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-1
View File
@@ -23,7 +23,6 @@ import blenderbim.core.tool
import blenderbim.tool as tool
import blenderbim.bim.schema
from typing import Union
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
class Pset(blenderbim.core.tool.Pset):
+4 -7
View File
@@ -16,20 +16,17 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
from types import ClassMethodDescriptorType
import bpy
import blenderbim.core.tool
import blenderbim.bim.schema
import blenderbim.tool as tool
import ifcopenshell
from mathutils import Vector
from ifcopenshell import util
import ifcopenshell.util.unit
import ifcopenshell.util.element
from blenderbim.bim.module.pset.qto_calculator import QtoCalculator, QuanityTypes
from blenderbim.bim.module.pset.calc_quantity_function_mapper import mapper
import blenderbim.bim.schema
from mathutils import Vector
from typing import Optional, Union, Literal
QuantityTypes = Literal["Q_LENGTH", "Q_AREA", "Q_VOLUME"]
class Qto(blenderbim.core.tool.Qto):
@classmethod
@@ -101,7 +98,7 @@ class Qto(blenderbim.core.tool.Qto):
value: float,
qto_name: Optional[str] = None,
quantity_name: Optional[str] = None,
quantity_type: Optional[QuanityTypes] = None,
quantity_type: Optional[QuantityTypes] = None,
) -> Union[float, None]:
"""You can either specify `quantity_type` or provide `qto_name/quantity_name`
to let method figure the `quantity_type` from the templates
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "IFC4 Base Quantities",
"name": "IFC4 Base Quantities - IfcOpenShell",
"description": "This ruleset quantifies every single possible standardised base quantity in IFC4 using only IfcOpenShell as a geometry processor.",
"calculators": {
"IOSTriangulation": {
@@ -0,0 +1,637 @@
{
"name": "IFC4 Base Quantities - Blender",
"description": "This ruleset quantifies every single possible standardised base quantity in IFC4 using Blender.",
"calculators": {
"Blender": {
"IfcActuator": {
"Qto_ActuatorBaseQuantities": {
"GrossWeight": null
}
},
"IfcAirTerminal": {
"Qto_AirTerminalBaseQuantities": {
"GrossWeight": null,
"Perimeter": null,
"TotalSurfaceArea": null
}
},
"IfcAirTerminalBox": {
"Qto_AirTerminalBoxTypeBaseQuantities": {
"GrossWeight": null
}
},
"IfcAirToAirHeatRecovery": {
"Qto_AirToAirHeatRecoveryBaseQuantities": {
"GrossWeight": null
}
},
"IfcAlarm": {
"Qto_AlarmBaseQuantities": {
"GrossWeight": null
}
},
"IfcAudioVisualAppliance": {
"Qto_AudioVisualApplianceBaseQuantities": {
"GrossWeight": null
}
},
"IfcBeam": {
"Qto_BeamBaseQuantities": {
"CrossSectionArea": "get_cross_section_area",
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetSurfaceArea": "get_net_surface_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcBoiler": {
"Qto_BoilerBaseQuantities": {
"GrossWeight": null,
"NetWeight": null,
"TotalSurfaceArea": null
}
},
"IfcBuilding": {
"Qto_BuildingBaseQuantities": {
"EavesHeight": null,
"FootprintArea": null,
"GrossFloorArea": null,
"GrossVolume": null,
"Height": null,
"NetFloorArea": null,
"NetVolume": null
}
},
"IfcBuildingElementProxy": {
"Qto_BuildingElementProxyQuantities": {
"NetSurfaceArea": "get_net_surface_area",
"NetVolume": "get_net_volume"
}
},
"IfcBuildingStorey": {
"Qto_BuildingStoreyBaseQuantities": {
"GrossFloorArea": null,
"GrossHeight": null,
"GrossPerimeter": null,
"GrossVolume": null,
"NetFloorArea": null,
"NetHeigtht": null,
"NetVolume": null
}
},
"IfcBurner": {
"Qto_BurnerBaseQuantities": {
"GrossWeight": null
}
},
"IfcCableCarrierFitting": {
"Qto_CableCarrierFittingBaseQuantities": {
"GrossWeight": null
}
},
"IfcCableCarrierSegment": {
"Qto_CableCarrierSegmentBaseQuantities": {
"CrossSectionArea": null,
"GrossWeight": null,
"Length": null,
"OuterSurfaceArea": null
}
},
"IfcCableFitting": {
"Qto_CableFittingBaseQuantities": {
"GrossWeight": null
}
},
"IfcCableSegment": {
"Qto_CableSegmentBaseQuantities": {
"CrossSectionArea": null,
"GrossWeight": null,
"Length": "get_length",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcChiller": {
"Qto_ChillerBaseQuantities": {
"GrossWeight": null
}
},
"IfcChimney": {
"Qto_ChimneyBaseQuantities": {
"Length": "get_height"
}
},
"IfcCoil": {
"Qto_CoilBaseQuantities": {
"GrossWeight": null
}
},
"IfcColumn": {
"Qto_ColumnBaseQuantities": {
"CrossSectionArea": "get_cross_section_area",
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetSurfaceArea": "get_net_surface_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcCommunicationsAppliance": {
"Qto_CommunicationsApplianceBaseQuantities": {
"GrossWeight": null
}
},
"IfcCompressor": {
"Qto_CompressorBaseQuantities": {
"GrossWeight": null
}
},
"IfcCondenser": {
"Qto_CondenserBaseQuantities": {
"GrossWeight": null
}
},
"IfcConstructionEquipmentResource": {
"Qto_ConstructionEquipmentResourceBaseQuantities": {
"OperatingTime": null,
"UsageTime": null
}
},
"IfcConstructionMaterialResource": {
"Qto_ConstructionMaterialResourceBaseQuantities": {
"GrossVolume": "get_gross_volume",
"GrossWeight": null,
"NetVolume": "get_net_volume",
"NetWeight": null
}
},
"IfcController": {
"Qto_ControllerBaseQuantities": {
"GrossWeight": null
}
},
"IfcCooledBeam": {
"Qto_CooledBeamBaseQuantities": {
"GrossWeight": null
}
},
"IfcCoolingTower": {
"Qto_CoolingTowerBaseQuantities": {
"GrossWeight": null
}
},
"IfcCovering": {
"Qto_CoveringBaseQuantities": {
"GrossArea": "get_covering_gross_area",
"NetArea": "get_covering_net_area",
"Width": "get_covering_width"
}
},
"IfcCurtainWall": {
"Qto_CurtainWallQuantities": {
"GrossSideArea": null,
"Height": null,
"Length": null,
"NetSideArea": null,
"Width": null
}
},
"IfcDamper": {
"Qto_DamperBaseQuantities": {
"GrossWeight": null
}
},
"IfcDistributionChamberElement": {
"Qto_DistributionChamberElementBaseQuantities": {
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"NetSurfaceArea": "get_net_surface_area",
"NetVolume": "get_net_volume"
}
},
"IfcDoor": {
"Qto_DoorBaseQuantities": {
"Area": "get_net_side_area",
"Height": "get_height",
"Perimeter": "get_rectangular_perimeter",
"Width": "get_length"
}
},
"IfcDuctFitting": {
"Qto_DuctFittingBaseQuantities": {
"GrossCrossSectionArea": null,
"GrossWeight": null,
"Length": "get_length",
"NetCrossSectionArea": null,
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcDuctSegment": {
"Qto_DuctSegmentBaseQuantities": {
"GrossCrossSectionArea": null,
"GrossWeight": null,
"Length": "get_length",
"NetCrossSectionArea": null,
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcDuctSilencer": {
"Qto_DuctSilencerBaseQuantities": {
"GrossWeight": null
}
},
"IfcElectricAppliance": {
"Qto_ElectricApplianceBaseQuantities": {
"GrossWeight": null
}
},
"IfcElectricDistributionBoard": {
"Qto_ElectricDistributionBoardBaseQuantities": {
"GrossWeight": null,
"NumberOfCircuits": null
}
},
"IfcElectricFlowStorageDevice": {
"Qto_ElectricFlowStorageDeviceBaseQuantities": {
"GrossWeight": null
}
},
"IfcElectricGenerator": {
"Qto_ElectricGeneratorBaseQuantities": {
"GrossWeight": null
}
},
"IfcElectricMotor": {
"Qto_ElectricMotorBaseQuantities": {
"GrossWeight": null
}
},
"IfcElectricTimeControl": {
"Qto_ElectricTimeControlBaseQuantities": {
"GrossWeight": null
}
},
"IfcEvaporativeCooler": {
"Qto_EvaporativeCoolerBaseQuantities": {
"GrossWeight": null
}
},
"IfcEvaporator": {
"Qto_EvaporatorBaseQuantities": {
"GrossWeight": null
}
},
"IfcFan": {
"Qto_FanBaseQuantities": {
"GrossWeight": null
}
},
"IfcFilter": {
"Qto_FilterBaseQuantities": {
"GrossWeight": null
}
},
"IfcFireSuppressionTerminal": {
"Qto_FireSuppressionTerminalBaseQuantities": {
"GrossWeight": null
}
},
"IfcFlowInstrument": {
"Qto_FlowInstrumentBaseQuantities": {
"GrossWeight": null
}
},
"IfcFlowMeter": {
"Qto_FlowMeterBaseQuantities": {
"GrossWeight": null
}
},
"IfcFooting": {
"Qto_FootingBaseQuantities": {
"CrossSectionArea": "get_cross_section_area",
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Height": "get_height",
"Length": "get_length",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area",
"Width": "get_width"
}
},
"IfcHeatExchanger": {
"Qto_HeatExchangerBaseQuantities": {
"GrossWeight": null
}
},
"IfcHumidifier": {
"Qto_HumidifierBaseQuantities": {
"GrossWeight": null
}
},
"IfcInterceptor": {
"Qto_InterceptorBaseQuantities": {
"GrossWeight": null
}
},
"IfcJunctionBox": {
"Qto_JunctionBoxBaseQuantities": {
"GrossWeight": null,
"NumberOfGangs": null
}
},
"IfcLaborResource": {
"Qto_LaborResourceBaseQuantities": {
"OvertimeWork": null,
"StandardWork": null
}
},
"IfcLamp": {
"Qto_LampBaseQuantities": {
"GrossWeight": null
}
},
"IfcLightFixture": {
"Qto_LightFixtureBaseQuantities": {
"GrossWeight": null
}
},
"IfcMember": {
"Qto_MemberBaseQuantities": {
"CrossSectionArea": "get_cross_section_area",
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetSurfaceArea": "get_net_surface_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcMotorConnection": {
"Qto_MotorConnectionBaseQuantities": {
"GrossWeight": null
}
},
"IfcOpeningElement": {
"Qto_OpeningElementBaseQuantities": {
"Area": "get_opening_mapping_area",
"Depth": "get_opening_depth",
"Height": "get_opening_height",
"Volume": "get_net_volume",
"Width": "get_length"
}
},
"IfcOutlet": {
"Qto_OutletBaseQuantities": {
"GrossWeight": null
}
},
"IfcPile": {
"Qto_PileBaseQuantities": {
"CrossSectionArea": "get_cross_section_area",
"GrossSurfaceArea": "get_gross_surface_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcPipeFitting": {
"Qto_PipeFittingBaseQuantities": {
"GrossCrossSectionArea": null,
"GrossWeight": null,
"Length": null,
"NetCrossSectionArea": null,
"NetWeight": null,
"OuterSurfaceArea": null
}
},
"IfcPipeSegment": {
"Qto_PipeSegmentBaseQuantities": {
"GrossCrossSectionArea": null,
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetCrossSectionArea": "get_cross_section_area",
"NetWeight": "get_net_weight",
"OuterSurfaceArea": "get_outer_surface_area"
}
},
"IfcPlate": {
"Qto_PlateBaseQuantities": {
"GrossArea": "get_gross_footprint_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"NetArea": "get_net_footprint_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"Perimeter": "get_gross_perimeter",
"Width": "get_height"
}
},
"IfcProjectionElement": {
"Qto_ProjectionElementBaseQuantities": {
"Area": "get_net_side_area",
"Volume": "get_net_volume"
}
},
"IfcProtectiveDevice": {
"Qto_ProtectiveDeviceBaseQuantities": {
"GrossWeight": null
}
},
"IfcProtectiveDeviceTrippingUnit": {
"Qto_ProtectiveDeviceTrippingUnitBaseQuantities": {
"GrossWeight": null
}
},
"IfcPump": {
"Qto_PumpBaseQuantities": {
"GrossWeight": null
}
},
"IfcRailing": {
"Qto_RailingBaseQuantities": {
"Length": "get_length"
}
},
"IfcRampFlight": {
"Qto_RampFlightBaseQuantities": {
"GrossArea": "get_gross_stair_area",
"GrossVolume": "get_gross_volume",
"Length": "get_stair_length",
"NetArea": "get_net_stair_area",
"NetVolume": "get_net_volume",
"Width": "get_width"
}
},
"IfcReinforcingElement": {
"Qto_ReinforcingElementBaseQuantities": {
"Count": null,
"Length": "get_length",
"Weight": null
}
},
"IfcRoof": {
"Qto_RoofBaseQuantities": {
"GrossArea": "get_gross_top_area",
"NetArea": "get_net_top_area",
"ProjectedArea": null
}
},
"IfcSanitaryTerminal": {
"Qto_SanitaryTerminalBaseQuantities": {
"GrossWeight": null
}
},
"IfcSensor": {
"Qto_SensorBaseQuantities": {
"GrossWeight": null
}
},
"IfcSite": {
"Qto_SiteBaseQuantities": {
"GrossArea": "get_gross_footprint_area",
"GrossPerimeter": "get_gross_perimeter"
}
},
"IfcSlab": {
"Qto_SlabBaseQuantities": {
"Depth": "get_height",
"GrossArea": "get_gross_footprint_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Length": "get_length",
"NetArea": "get_net_footprint_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"Perimeter": "get_gross_perimeter",
"Width": "get_width"
}
},
"IfcSolarDevice": {
"Qto_SolarDeviceBaseQuantities": {
"GrossArea": null,
"GrossWeight": null
}
},
"IfcSpace": {
"Qto_SpaceBaseQuantities": {
"FinishCeilingHeight": "get_finish_ceiling_height",
"FinishFloorHeight": "get_finish_floor_height",
"GrossCeilingArea": "get_gross_ceiling_area",
"GrossFloorArea": "get_gross_footprint_area",
"GrossPerimeter": "get_gross_perimeter",
"GrossVolume": "get_gross_volume",
"GrossWallArea": null,
"Height": "get_height",
"NetCeilingArea": "get_net_ceiling_area",
"NetFloorArea": "get_net_floor_area",
"NetPerimeter": null,
"NetVolume": "get_space_net_volume",
"NetWallArea": null
}
},
"IfcSpaceHeater": {
"Qto_SpaceHeaterBaseQuantities": {
"GrossWeight": null,
"Length": "get_length",
"NetWeight": null
}
},
"IfcStackTerminal": {
"Qto_StackTerminalBaseQuantities": {
"GrossWeight": null
}
},
"IfcStairFlight": {
"Qto_StairFlightBaseQuantities": {
"GrossVolume": "get_gross_volume",
"Length": "get_stair_length",
"NetVolume": "get_net_volume"
}
},
"IfcSwitchingDevice": {
"Qto_SwitchingDeviceBaseQuantities": {
"GrossWeight": null
}
},
"IfcTank": {
"Qto_TankBaseQuantities": {
"GrossWeight": null,
"NetWeight": null,
"TotalSurfaceArea": "get_outer_surface_area"
}
},
"IfcTransformer": {
"Qto_TransformerBaseQuantities": {
"GrossWeight": null
}
},
"IfcTubeBundle": {
"Qto_TubeBundleBaseQuantities": {
"GrossWeight": null,
"NetWeight": null
}
},
"IfcUnitaryControlElement": {
"Qto_UnitaryControlElementBaseQuantities": {
"GrossWeight": null
}
},
"IfcUnitaryEquipment": {
"Qto_UnitaryEquipmentBaseQuantities": {
"GrossWeight": null
}
},
"IfcValve": {
"Qto_ValveBaseQuantities": {
"GrossWeight": null
}
},
"IfcVibrationIsolator": {
"Qto_VibrationIsolatorBaseQuantities": {
"GrossWeight": null
}
},
"IfcWall": {
"Qto_WallBaseQuantities": {
"GrossFootprintArea": "get_gross_footprint_area",
"GrossSideArea": "get_gross_side_area",
"GrossVolume": "get_gross_volume",
"GrossWeight": "get_gross_weight",
"Height": "get_height",
"Length": "get_length",
"NetFootprintArea": "get_net_footprint_area",
"NetSideArea": "get_net_side_area",
"NetVolume": "get_net_volume",
"NetWeight": "get_net_weight",
"Width": "get_width"
}
},
"IfcWasteTerminal": {
"Qto_WasteTerminalBaseQuantities": {
"GrossWeight": null
}
},
"IfcWindow": {
"Qto_WindowBaseQuantities": {
"Area": "get_net_side_area",
"Height": "get_height",
"Perimeter": "get_rectangular_perimeter",
"Width": "get_length"
}
}
}
}
}
+12 -11
View File
@@ -38,7 +38,8 @@ def quantify(ifc_file: ifcopenshell.file, elements: set[ifcopenshell.entity_inst
calculator = calculators[calculator]
for query, qtos in queries.items():
filtered_elements = ifcopenshell.util.selector.filter_elements(ifc_file, query, elements)
calculator.calculate(ifc_file, filtered_elements, qtos, results)
if filtered_elements:
calculator.calculate(ifc_file, filtered_elements, qtos, results)
return results
@@ -59,15 +60,12 @@ class IOSTriangulation:
ifc_file: ifcopenshell.file,
elements: set[ifcopenshell.entity_instance],
qtos: dict,
results: Optional[dict] = None,
results: dict,
):
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.util.shape
if results is None:
results = {}
formula_functions = {}
gross_settings = ifcopenshell.geom.settings()
@@ -109,8 +107,6 @@ class IOSTriangulation:
if not iterator.next():
break
return results
@staticmethod
def create_iterator(ifc_file, settings, elements):
return ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count(), include=elements)
@@ -118,18 +114,23 @@ class IOSTriangulation:
class Blender:
@staticmethod
def calculate(ifc_file, elements, qtos):
def calculate(ifc_file: ifcopenshell.file, elements: set[ifcopenshell.entity_instance], qtos: dict, results: dict):
import blenderbim.tool as tool
import blenderbim.bim.module.qto.calculator as calculator
formula_functions = {}
for element in elements:
obj = tool.Ifc.get_object(element)
if not obj:
continue
results.setdefault(element, {})
for name, quantities in qtos.items():
results[element].setdefault(name, {})
for quantity, formula in quantities.items():
getattr(tool.Qto, formula)
# TODO
if not (formula_function := formula_functions.get(formula)):
formula_function = formula_functions[formula] = getattr(calculator, formula)
results[element][name][quantity] = formula_function(obj)
calculators = {"Blender": Blender, "IOSTriangulation": IOSTriangulation}