Utility to print out all maintainable assets for FM paper documentation

This commit is contained in:
Dion Moult
2021-10-14 11:36:46 +11:00
parent 7fb77a794e
commit 179a970974
2 changed files with 53 additions and 3 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
# IfcFM - IFC for facility management
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
@@ -277,7 +276,7 @@ class Parser:
# Hack
category = None
if ifc_file == "arch":
#if "Data" in psets and "COBie.Type.Category" in psets["Data"]:
# if "Data" in psets and "COBie.Type.Category" in psets["Data"]:
# if ":" in psets["Data"]["COBie.Type.Category"]:
# category = psets["Data"]["COBie.Type.Category"].replace(" : ", ":")
if "Data" in psets and "Classification.Uniclass.Pr.Number" in psets["Data"]:
@@ -332,7 +331,7 @@ class Parser:
else:
space = element.ContainedInStructure[0].RelatingStructure
if space.is_a("IfcSpace"):
space_name = space.Name
space_name = space.Name
self.components[name] = {
"Name": name,
+51
View File
@@ -0,0 +1,51 @@
# IfcFM - IFC for facility management
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcFM.
#
# IfcFM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcFM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcFM. If not, see <http://www.gnu.org/licenses/>.
import textwrap
import ifcopenshell
import ifcopenshell.util.fm
import ifcopenshell.util.attribute
def print_element(declaration, levels=0):
if declaration.name() == "IfcCooledBeamType":
return
if declaration.is_abstract():
print("{}{} (abstract)".format("\t\t" * levels, declaration.name()))
else:
types = []
for attribute in declaration.all_attributes():
if attribute.name() == "PredefinedType":
types = ifcopenshell.util.attribute.get_enum_items(attribute)
print("{}{}".format("\t\t" * levels, declaration.name()))
if types:
for line in textwrap.wrap(", ".join(types), width=60):
print("{}{}".format("\t\t" * (levels + 1), line))
for subtype in declaration.subtypes():
print_element(subtype, levels=levels + 1)
def print_fmhem_documentation(schema="IFC4"):
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema)
for ifc_class in ifcopenshell.util.fm.fmhem_classes:
try:
declaration = schema.declaration_by_name(ifc_class)
print_element(declaration)
except:
pass