black ifccobie

This commit is contained in:
htlcnn
2020-11-01 19:23:25 +07:00
committed by Dion Moult
parent 892be5444c
commit d169a964dd
2 changed files with 1088 additions and 668 deletions
+1051 -648
View File
File diff suppressed because it is too large Load Diff
+37 -20
View File
@@ -2,42 +2,59 @@ import json
import ifcopenshell import ifcopenshell
import ifcopenshell.util.selector import ifcopenshell.util.selector
with open('../ifcblenderexport/blenderbim/bim/schema/entity_descriptions.json') as f: with open("../ifcblenderexport/blenderbim/bim/schema/entity_descriptions.json") as f:
entity_descriptions = json.load(f) entity_descriptions = json.load(f)
with open('../ifcblenderexport/blenderbim/bim/schema/enum_descriptions.json') as f: with open("../ifcblenderexport/blenderbim/bim/schema/enum_descriptions.json") as f:
enum_descriptions = json.load(f) enum_descriptions = json.load(f)
print('{|class="wikitable"') print('{|class="wikitable"')
print('! IFC Class') print("! IFC Class")
print('! Predefined Type') print("! Predefined Type")
def print_entity(entity): def print_entity(entity):
print('|-') print("|-")
print('| ' + entity.name()) print("| " + entity.name())
print('| ') print("| ")
if entity.name() in entity_descriptions: 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())) print(
"{} ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]".format(
entity_descriptions[entity.name()], entity.name().lower()
)
)
else: 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())) 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(): for attribute in entity.attributes():
if attribute.name() == 'PredefinedType': if attribute.name() == "PredefinedType":
enum = attribute.type_of_attribute().declared_type() enum = attribute.type_of_attribute().declared_type()
print('\nThe following predefined types are defined:\n') print("\nThe following predefined types are defined:\n")
for item in enum.enumeration_items(): for item in enum.enumeration_items():
#print('|-') # print('|-')
#print('| ' + entity.name()) # print('| ' + entity.name())
#print('| ' + item) # print('| ' + item)
if enum.name() in enum_descriptions \ if enum.name() in enum_descriptions and item in enum_descriptions[enum.name()]:
and item in enum_descriptions[enum.name()]: print(
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())) "* '''{}''' - {} ... [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: else:
print('* \'\'\'{}\'\'\' - No description provided ... [https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC1/HTML/link/{}.htm read more]'.format(item, enum.name().lower())) 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(): for subtype in entity.subtypes():
print_entity(subtype) print_entity(subtype)
for asset in ifcopenshell.util.selector.cobie_component_assets: for asset in ifcopenshell.util.selector.cobie_component_assets:
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name('IFC4') schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name("IFC4")
print_entity(schema.declaration_by_name(asset)) print_entity(schema.declaration_by_name(asset))
print('|}') print("|}")