Clean up IfcFM's Basic preset to be more true to IFC rather than follow naming schemes from stuff like COBie

This commit is contained in:
Dion Moult
2023-10-03 21:21:16 +11:00
parent a24fab6d92
commit 82d4829c83
+56 -40
View File
@@ -64,9 +64,10 @@ def get_facility_data(ifc_file, element):
"Name": element.Name, "Name": element.Name,
"ProjectName": ifc_file.by_type("IfcProject")[0].Name, "ProjectName": ifc_file.by_type("IfcProject")[0].Name,
"SiteName": getattr(get_facility_parent(element, "IfcSite"), "Name", None), "SiteName": getattr(get_facility_parent(element, "IfcSite"), "Name", None),
"Category": get_classification(element), "ClassificationIdentification": get_classification_identification(element),
"AuthorOrganizationName": get_owner_name(element), "ClassificationName": get_classification_name(element),
"AuthorDate": get_owner_creation_date(element), "OrganizationName": get_owner_name(element),
"CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelProjectID": ifc_file.by_type("IfcProject")[0].GlobalId, "ModelProjectID": ifc_file.by_type("IfcProject")[0].GlobalId,
"ModelSiteID": getattr(get_facility_parent(element, "IfcSite"), "GlobalId", None), "ModelSiteID": getattr(get_facility_parent(element, "IfcSite"), "GlobalId", None),
@@ -80,9 +81,10 @@ def get_facility_data(ifc_file, element):
def get_storey_data(ifc_file, element): def get_storey_data(ifc_file, element):
return { return {
"Name": element.Name, "Name": element.Name,
"Category": "Level", "ClassificationIdentification": "Level",
"AuthorOrganizationName": get_owner_name(element), "ClassificationName": get_classification_name(element),
"AuthorDate": get_owner_creation_date(element), "OrganizationName": get_owner_name(element),
"CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelObject": element.is_a(), "ModelObject": element.is_a(),
"ModelID": element.GlobalId, "ModelID": element.GlobalId,
@@ -95,10 +97,11 @@ def get_space_data(ifc_file, element):
return { return {
"Name": element.Name, "Name": element.Name,
"Description": element.LongName, "Description": element.LongName,
"Category": get_classification(element), "ClassificationIdentification": get_classification_identification(element),
"ClassificationName": get_classification_name(element),
"LevelName": getattr(get_facility_parent(element, "IfcBuildingStorey"), "Name", None), "LevelName": getattr(get_facility_parent(element, "IfcBuildingStorey"), "Name", None),
"AuthorOrganizationName": get_owner_name(element), "OrganizationName": get_owner_name(element),
"AuthorDate": get_owner_creation_date(element), "CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelID": element.GlobalId, "ModelID": element.GlobalId,
"AreaGross": get_property(psets, "Qto_SpaceBaseQuantities", "GrossFloorArea", decimals=2), "AreaGross": get_property(psets, "Qto_SpaceBaseQuantities", "GrossFloorArea", decimals=2),
@@ -111,8 +114,8 @@ def get_zone_data(ifc_file, element):
return { return {
"Name": zone.Name, "Name": zone.Name,
"SpaceName": space.Name, "SpaceName": space.Name,
"AuthorOrganizationName": get_owner_name(zone), "OrganizationName": get_owner_name(zone),
"AuthorDate": get_owner_creation_date(zone), "CreationDate": get_owner_creation_date(zone),
"ModelSoftware": get_owner_application(zone), "ModelSoftware": get_owner_application(zone),
"ModelID": zone.GlobalId, "ModelID": zone.GlobalId,
} }
@@ -123,9 +126,10 @@ def get_element_type_data(ifc_file, element):
return { return {
"Name": element.Name, "Name": element.Name,
"Description": element.Description, "Description": element.Description,
"Category": get_classification(element), "ClassificationIdentification": get_classification_identification(element),
"AuthorOrganizationName": get_owner_name(element), "ClassificationName": get_classification_name(element),
"AuthorDate": get_owner_creation_date(element), "OrganizationName": get_owner_name(element),
"CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)), "ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)),
"ModelID": element.GlobalId, "ModelID": element.GlobalId,
@@ -149,8 +153,8 @@ def get_element_data(ifc_file, element):
"TypeName": ifcopenshell.util.element.get_type(element).Name, "TypeName": ifcopenshell.util.element.get_type(element).Name,
"SpaceName": space_name, "SpaceName": space_name,
"SystemName": system, "SystemName": system,
"AuthorOrganizationName": get_owner_name(element), "OrganizationName": get_owner_name(element),
"AuthorDate": get_owner_creation_date(element), "CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)), "ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)),
"ModelID": element.GlobalId, "ModelID": element.GlobalId,
@@ -169,9 +173,10 @@ def get_system_data(ifc_file, element):
return { return {
"Name": element.Name, "Name": element.Name,
"Description": element.Description, "Description": element.Description,
"Category": get_classification(element), "ClassificationIdentification": get_classification_identification(element),
"AuthorOrganizationName": get_owner_name(element), "ClassificationName": get_classification_name(element),
"AuthorDate": get_owner_creation_date(element), "OrganizationName": get_owner_name(element),
"CreationDate": get_owner_creation_date(element),
"ModelSoftware": get_owner_application(element), "ModelSoftware": get_owner_application(element),
"ModelID": element.GlobalId, "ModelID": element.GlobalId,
} }
@@ -205,12 +210,18 @@ def get_facility_parent(element, ifc_class):
parent = ifcopenshell.util.element.get_aggregate(parent) parent = ifcopenshell.util.element.get_aggregate(parent)
def get_classification(element): def get_classification_identification(element):
references = list(ifcopenshell.util.classification.get_references(element)) references = list(ifcopenshell.util.classification.get_references(element))
if references: if references:
if hasattr(references[0], "Identification"): if hasattr(references[0], "Identification"):
return "{}:{}".format(references[0].Identification, references[0].Name) return references[0].Identification
return "{}:{}".format(references[0].ItemReference, references[0].Name) return references[0].ItemReference
def get_classification_name(element):
references = list(ifcopenshell.util.classification.get_references(element))
if references:
return references[0].Name
def get_property(psets, pset_name, prop_name, decimals=None): def get_property(psets, pset_name, prop_name, decimals=None):
@@ -239,9 +250,10 @@ config = {
"Name", "Name",
"ProjectName", "ProjectName",
"SiteName", "SiteName",
"Category", "ClassificationIdentification",
"AuthorOrganizationName", "ClassificationName",
"AuthorDate", "OrganizationName",
"CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelProjectID", "ModelProjectID",
"ModelSiteID", "ModelSiteID",
@@ -259,9 +271,10 @@ config = {
"keys": ["Name"], "keys": ["Name"],
"headers": [ "headers": [
"Name", "Name",
"Category", "ClassificationIdentification",
"AuthorOrganizationName", "ClassificationName",
"AuthorDate", "OrganizationName",
"CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelObject", "ModelObject",
"ModelID", "ModelID",
@@ -277,10 +290,11 @@ config = {
"headers": [ "headers": [
"Name", "Name",
"Description", "Description",
"Category", "ClassificationIdentification",
"ClassificationName",
"LevelName", "LevelName",
"AuthorOrganizationName", "OrganizationName",
"AuthorDate", "CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelID", "ModelID",
"AreaGross", "AreaGross",
@@ -293,7 +307,7 @@ config = {
}, },
"Zones": { "Zones": {
"keys": ["Name", "SpaceName"], "keys": ["Name", "SpaceName"],
"headers": ["Name", "SpaceName", "AuthorOrganizationName", "AuthorDate", "ModelSoftware", "ModelID"], "headers": ["Name", "SpaceName", "OrganizationName", "CreationDate", "ModelSoftware", "ModelID"],
"colours": "prreee", "colours": "prreee",
"sort": [{"name": "Name", "order": "ASC"}], "sort": [{"name": "Name", "order": "ASC"}],
"get_category_elements": get_zones, "get_category_elements": get_zones,
@@ -304,9 +318,10 @@ config = {
"headers": [ "headers": [
"Name", "Name",
"Description", "Description",
"Category", "ClassificationIdentification",
"AuthorOrganizationName", "ClassificationName",
"AuthorDate", "OrganizationName",
"CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelObject", "ModelObject",
"ModelID", "ModelID",
@@ -329,8 +344,8 @@ config = {
"TypeName", "TypeName",
"SpaceName", "SpaceName",
"SystemName", "SystemName",
"AuthorOrganizationName", "OrganizationName",
"AuthorDate", "CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelObject", "ModelObject",
"ModelID", "ModelID",
@@ -353,9 +368,10 @@ config = {
"headers": [ "headers": [
"Name", "Name",
"Description", "Description",
"Category", "ClassificationIdentification",
"AuthorOrganizationName", "ClassificationName",
"AuthorDate", "OrganizationName",
"CreationDate",
"ModelSoftware", "ModelSoftware",
"ModelID", "ModelID",
], ],