mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
New FM utility module for selecting maintainable assets according to different FM definitions
This commit is contained in:
@@ -0,0 +1,107 @@
|
|||||||
|
cobie_type_classes = [
|
||||||
|
"IfcDoorStyle",
|
||||||
|
"IfcBuildingElementProxyType",
|
||||||
|
"IfcChimneyType",
|
||||||
|
"IfcCoveringType",
|
||||||
|
"IfcDoorType",
|
||||||
|
"IfcFootingType",
|
||||||
|
"IfcPileType",
|
||||||
|
"IfcRoofType",
|
||||||
|
"IfcShadingDeviceType",
|
||||||
|
"IfcWindowType",
|
||||||
|
"IfcDistributionControlElementType",
|
||||||
|
"IfcDistributionChamberElementType",
|
||||||
|
"IfcEnergyConversionDeviceType",
|
||||||
|
"IfcFlowControllerType",
|
||||||
|
"IfcFlowMovingDeviceType",
|
||||||
|
"IfcFlowStorageDeviceType",
|
||||||
|
"IfcFlowTerminalType",
|
||||||
|
"IfcFlowTreatmentDeviceType",
|
||||||
|
"IfcElementAssemblyType",
|
||||||
|
"IfcBuildingElementPartType",
|
||||||
|
"IfcDiscreteAccessoryType",
|
||||||
|
"IfcMechanicalFastenerType",
|
||||||
|
"IfcReinforcingElementType",
|
||||||
|
"IfcVibrationIsolatorType",
|
||||||
|
"IfcFurnishingElementType",
|
||||||
|
"IfcGeographicElementType",
|
||||||
|
"IfcTransportElementType",
|
||||||
|
"IfcSpatialZoneType",
|
||||||
|
"IfcWindowStyle",
|
||||||
|
]
|
||||||
|
|
||||||
|
cobie_component_classes = [
|
||||||
|
"IfcBuildingElementProxy",
|
||||||
|
"IfcChimney",
|
||||||
|
"IfcCovering",
|
||||||
|
"IfcDoor",
|
||||||
|
"IfcShadingDevice",
|
||||||
|
"IfcWindow",
|
||||||
|
"IfcDistributionControlElement",
|
||||||
|
"IfcDistributionChamberElement",
|
||||||
|
"IfcEnergyConversionDevice",
|
||||||
|
"IfcFlowController",
|
||||||
|
"IfcFlowMovingDevice",
|
||||||
|
"IfcFlowStorageDevice",
|
||||||
|
"IfcFlowTerminal",
|
||||||
|
"IfcFlowTreatmentDevice",
|
||||||
|
"IfcDiscreteAccessory",
|
||||||
|
"IfcTendon",
|
||||||
|
"IfcTendonAnchor",
|
||||||
|
"IfcVibrationIsolator",
|
||||||
|
"IfcFurnishingElement",
|
||||||
|
"IfcGeographicElement",
|
||||||
|
"IfcTransportElement",
|
||||||
|
]
|
||||||
|
|
||||||
|
fmhem_classes = [
|
||||||
|
"IfcDoorStyle",
|
||||||
|
"IfcWindowStyle",
|
||||||
|
"IfcDoorType",
|
||||||
|
"IfcWindowType",
|
||||||
|
"IfcRoofType",
|
||||||
|
"IfcShadingDeviceType",
|
||||||
|
"IfcDistributionControlElementType",
|
||||||
|
"IfcEnergyConversionDeviceType",
|
||||||
|
"IfcFlowControllerType",
|
||||||
|
"IfcJunctionBoxType",
|
||||||
|
"IfcFlowMovingDeviceType",
|
||||||
|
"IfcFlowStorageDeviceType",
|
||||||
|
"IfcFlowTerminalType",
|
||||||
|
"IfcFlowTreatmentDeviceType",
|
||||||
|
"IfcFurnishingElementType",
|
||||||
|
"IfcTransportElementType",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_cobie_types(ifc_file):
|
||||||
|
elements = []
|
||||||
|
for ifc_class in cobie_type_classes:
|
||||||
|
try:
|
||||||
|
elements += self.file.by_type(ifc_class)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return elements
|
||||||
|
|
||||||
|
|
||||||
|
def get_cobie_components(ifc_file):
|
||||||
|
elements = []
|
||||||
|
for ifc_class in cobie_component_classes:
|
||||||
|
try:
|
||||||
|
elements += self.file.by_type(ifc_class)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return elements
|
||||||
|
|
||||||
|
|
||||||
|
def get_fmhem_types(ifc_file):
|
||||||
|
elements = []
|
||||||
|
for ifc_class in fmhem_classes:
|
||||||
|
try:
|
||||||
|
if ifc_class == "IfcEnergyConversionDeviceType":
|
||||||
|
elements += [e for e in ifc_file.by_type(ifc_class) if not e.is_a("IfcCooledBeamType")]
|
||||||
|
else:
|
||||||
|
elements += ifc_file.by_type(ifc_class)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return elements
|
||||||
@@ -1,62 +1,8 @@
|
|||||||
import ifcopenshell.util
|
import ifcopenshell.util
|
||||||
|
import ifcopenshell.util.fm
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
import lark
|
import lark
|
||||||
|
|
||||||
cobie_type_assets = [
|
|
||||||
"IfcDoorStyle",
|
|
||||||
"IfcBuildingElementProxyType",
|
|
||||||
"IfcChimneyType",
|
|
||||||
"IfcCoveringType",
|
|
||||||
"IfcDoorType",
|
|
||||||
"IfcFootingType",
|
|
||||||
"IfcPileType",
|
|
||||||
"IfcRoofType",
|
|
||||||
"IfcShadingDeviceType",
|
|
||||||
"IfcWindowType",
|
|
||||||
"IfcDistributionControlElementType",
|
|
||||||
"IfcDistributionChamberElementType",
|
|
||||||
"IfcEnergyConversionDeviceType",
|
|
||||||
"IfcFlowControllerType",
|
|
||||||
"IfcFlowMovingDeviceType",
|
|
||||||
"IfcFlowStorageDeviceType",
|
|
||||||
"IfcFlowTerminalType",
|
|
||||||
"IfcFlowTreatmentDeviceType",
|
|
||||||
"IfcElementAssemblyType",
|
|
||||||
"IfcBuildingElementPartType",
|
|
||||||
"IfcDiscreteAccessoryType",
|
|
||||||
"IfcMechanicalFastenerType",
|
|
||||||
"IfcReinforcingElementType",
|
|
||||||
"IfcVibrationIsolatorType",
|
|
||||||
"IfcFurnishingElementType",
|
|
||||||
"IfcGeographicElementType",
|
|
||||||
"IfcTransportElementType",
|
|
||||||
"IfcSpatialZoneType",
|
|
||||||
"IfcWindowStyle",
|
|
||||||
]
|
|
||||||
cobie_component_assets = [
|
|
||||||
"IfcBuildingElementProxy",
|
|
||||||
"IfcChimney",
|
|
||||||
"IfcCovering",
|
|
||||||
"IfcDoor",
|
|
||||||
"IfcShadingDevice",
|
|
||||||
"IfcWindow",
|
|
||||||
"IfcDistributionControlElement",
|
|
||||||
"IfcDistributionChamberElement",
|
|
||||||
"IfcEnergyConversionDevice",
|
|
||||||
"IfcFlowController",
|
|
||||||
"IfcFlowMovingDevice",
|
|
||||||
"IfcFlowStorageDevice",
|
|
||||||
"IfcFlowTerminal",
|
|
||||||
"IfcFlowTreatmentDevice",
|
|
||||||
"IfcDiscreteAccessory",
|
|
||||||
"IfcTendon",
|
|
||||||
"IfcTendonAnchor",
|
|
||||||
"IfcVibrationIsolator",
|
|
||||||
"IfcFurnishingElement",
|
|
||||||
"IfcGeographicElement",
|
|
||||||
"IfcTransportElement",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Selector:
|
class Selector:
|
||||||
def parse(self, ifc_file, query):
|
def parse(self, ifc_file, query):
|
||||||
@@ -174,19 +120,11 @@ class Selector:
|
|||||||
|
|
||||||
def get_class_selector(self, class_selector):
|
def get_class_selector(self, class_selector):
|
||||||
if class_selector.children[0] == "COBie":
|
if class_selector.children[0] == "COBie":
|
||||||
elements = []
|
ifcopenshell.util.fm.get_cobie_components(self.file)
|
||||||
for ifc_class in cobie_component_assets:
|
|
||||||
try:
|
|
||||||
elements += self.file.by_type(ifc_class)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
elif class_selector.children[0] == "COBieType":
|
elif class_selector.children[0] == "COBieType":
|
||||||
elements = []
|
ifcopenshell.util.fm.get_cobie_types(self.file)
|
||||||
for ifc_class in cobie_type_assets:
|
elif class_selector.children[0] == "FMHEM":
|
||||||
try:
|
ifcopenshell.util.fm.get_fmhem_types(self.file)
|
||||||
elements += self.file.by_type(ifc_class)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
elements = self.file.by_type(class_selector.children[0])
|
elements = self.file.by_type(class_selector.children[0])
|
||||||
if len(class_selector.children) > 1 and class_selector.children[1].data == "filter":
|
if len(class_selector.children) > 1 and class_selector.children[1].data == "filter":
|
||||||
|
|||||||
Reference in New Issue
Block a user