forked from IfcOpenShell/IfcOpenShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_maintainable_assets.py
79 lines (69 loc) · 3.1 KB
/
get_maintainable_assets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# IfcCOBie - Extract COBie data from IFC to spreadsheets
# Copyright (C) 2019, 2020, 2021 Dion Moult <[email protected]>
#
# This file is part of IfcCOBie.
#
# IfcCOBie 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.
#
# IfcCOBie 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 IfcCOBie. If not, see <http://www.gnu.org/licenses/>.
import json
import ifcopenshell
import ifcopenshell.util.selector
with open("../blenderbim/blenderbim/bim/schema/entity_descriptions.json") as f:
entity_descriptions = json.load(f)
with open("../blenderbim/blenderbim/bim/schema/enum_descriptions.json") as f:
enum_descriptions = json.load(f)
print('{|class="wikitable"')
print("! IFC Class")
print("! Predefined Type")
def print_entity(entity):
print("|-")
print("| " + entity.name())
print("| ")
if entity.name() in entity_descriptions:
print(
"{} ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]".format(
entity_descriptions[entity.name()], entity.name().lower()
)
)
else:
print(
"No description provided ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]".format(
entity_descriptions[entity.name()], entity.name().lower()
)
)
for attribute in entity.attributes():
if attribute.name() == "PredefinedType":
enum = attribute.type_of_attribute().declared_type()
print("\nThe following predefined types are defined:\n")
for item in enum.enumeration_items():
# print('|-')
# print('| ' + entity.name())
# print('| ' + item)
if enum.name() in enum_descriptions and item in enum_descriptions[enum.name()]:
print(
"* '''{}''' - {} ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]".format(
item, enum_descriptions[enum.name()][item], enum.name().lower()
)
)
else:
print(
"* '''{}''' - No description provided ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]".format(
item, enum.name().lower()
)
)
for subtype in entity.subtypes():
print_entity(subtype)
for asset in ifcopenshell.util.selector.cobie_component_assets:
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name("IFC4")
print_entity(schema.declaration_by_name(asset))
print("|}")