mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
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:
+56
-40
@@ -64,9 +64,10 @@ def get_facility_data(ifc_file, element):
|
||||
"Name": element.Name,
|
||||
"ProjectName": ifc_file.by_type("IfcProject")[0].Name,
|
||||
"SiteName": getattr(get_facility_parent(element, "IfcSite"), "Name", None),
|
||||
"Category": get_classification(element),
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"ClassificationIdentification": get_classification_identification(element),
|
||||
"ClassificationName": get_classification_name(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelProjectID": ifc_file.by_type("IfcProject")[0].GlobalId,
|
||||
"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):
|
||||
return {
|
||||
"Name": element.Name,
|
||||
"Category": "Level",
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"ClassificationIdentification": "Level",
|
||||
"ClassificationName": get_classification_name(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelObject": element.is_a(),
|
||||
"ModelID": element.GlobalId,
|
||||
@@ -95,10 +97,11 @@ def get_space_data(ifc_file, element):
|
||||
return {
|
||||
"Name": element.Name,
|
||||
"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),
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelID": element.GlobalId,
|
||||
"AreaGross": get_property(psets, "Qto_SpaceBaseQuantities", "GrossFloorArea", decimals=2),
|
||||
@@ -111,8 +114,8 @@ def get_zone_data(ifc_file, element):
|
||||
return {
|
||||
"Name": zone.Name,
|
||||
"SpaceName": space.Name,
|
||||
"AuthorOrganizationName": get_owner_name(zone),
|
||||
"AuthorDate": get_owner_creation_date(zone),
|
||||
"OrganizationName": get_owner_name(zone),
|
||||
"CreationDate": get_owner_creation_date(zone),
|
||||
"ModelSoftware": get_owner_application(zone),
|
||||
"ModelID": zone.GlobalId,
|
||||
}
|
||||
@@ -123,9 +126,10 @@ def get_element_type_data(ifc_file, element):
|
||||
return {
|
||||
"Name": element.Name,
|
||||
"Description": element.Description,
|
||||
"Category": get_classification(element),
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"ClassificationIdentification": get_classification_identification(element),
|
||||
"ClassificationName": get_classification_name(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)),
|
||||
"ModelID": element.GlobalId,
|
||||
@@ -149,8 +153,8 @@ def get_element_data(ifc_file, element):
|
||||
"TypeName": ifcopenshell.util.element.get_type(element).Name,
|
||||
"SpaceName": space_name,
|
||||
"SystemName": system,
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelObject": "{}[{}]".format(element.is_a(), ifcopenshell.util.element.get_predefined_type(element)),
|
||||
"ModelID": element.GlobalId,
|
||||
@@ -169,9 +173,10 @@ def get_system_data(ifc_file, element):
|
||||
return {
|
||||
"Name": element.Name,
|
||||
"Description": element.Description,
|
||||
"Category": get_classification(element),
|
||||
"AuthorOrganizationName": get_owner_name(element),
|
||||
"AuthorDate": get_owner_creation_date(element),
|
||||
"ClassificationIdentification": get_classification_identification(element),
|
||||
"ClassificationName": get_classification_name(element),
|
||||
"OrganizationName": get_owner_name(element),
|
||||
"CreationDate": get_owner_creation_date(element),
|
||||
"ModelSoftware": get_owner_application(element),
|
||||
"ModelID": element.GlobalId,
|
||||
}
|
||||
@@ -205,12 +210,18 @@ def get_facility_parent(element, ifc_class):
|
||||
parent = ifcopenshell.util.element.get_aggregate(parent)
|
||||
|
||||
|
||||
def get_classification(element):
|
||||
def get_classification_identification(element):
|
||||
references = list(ifcopenshell.util.classification.get_references(element))
|
||||
if references:
|
||||
if hasattr(references[0], "Identification"):
|
||||
return "{}:{}".format(references[0].Identification, references[0].Name)
|
||||
return "{}:{}".format(references[0].ItemReference, references[0].Name)
|
||||
return references[0].Identification
|
||||
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):
|
||||
@@ -239,9 +250,10 @@ config = {
|
||||
"Name",
|
||||
"ProjectName",
|
||||
"SiteName",
|
||||
"Category",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"ClassificationIdentification",
|
||||
"ClassificationName",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelProjectID",
|
||||
"ModelSiteID",
|
||||
@@ -259,9 +271,10 @@ config = {
|
||||
"keys": ["Name"],
|
||||
"headers": [
|
||||
"Name",
|
||||
"Category",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"ClassificationIdentification",
|
||||
"ClassificationName",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelObject",
|
||||
"ModelID",
|
||||
@@ -277,10 +290,11 @@ config = {
|
||||
"headers": [
|
||||
"Name",
|
||||
"Description",
|
||||
"Category",
|
||||
"ClassificationIdentification",
|
||||
"ClassificationName",
|
||||
"LevelName",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelID",
|
||||
"AreaGross",
|
||||
@@ -293,7 +307,7 @@ config = {
|
||||
},
|
||||
"Zones": {
|
||||
"keys": ["Name", "SpaceName"],
|
||||
"headers": ["Name", "SpaceName", "AuthorOrganizationName", "AuthorDate", "ModelSoftware", "ModelID"],
|
||||
"headers": ["Name", "SpaceName", "OrganizationName", "CreationDate", "ModelSoftware", "ModelID"],
|
||||
"colours": "prreee",
|
||||
"sort": [{"name": "Name", "order": "ASC"}],
|
||||
"get_category_elements": get_zones,
|
||||
@@ -304,9 +318,10 @@ config = {
|
||||
"headers": [
|
||||
"Name",
|
||||
"Description",
|
||||
"Category",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"ClassificationIdentification",
|
||||
"ClassificationName",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelObject",
|
||||
"ModelID",
|
||||
@@ -329,8 +344,8 @@ config = {
|
||||
"TypeName",
|
||||
"SpaceName",
|
||||
"SystemName",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelObject",
|
||||
"ModelID",
|
||||
@@ -353,9 +368,10 @@ config = {
|
||||
"headers": [
|
||||
"Name",
|
||||
"Description",
|
||||
"Category",
|
||||
"AuthorOrganizationName",
|
||||
"AuthorDate",
|
||||
"ClassificationIdentification",
|
||||
"ClassificationName",
|
||||
"OrganizationName",
|
||||
"CreationDate",
|
||||
"ModelSoftware",
|
||||
"ModelID",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user