Allow IfcStructural* elements to be exported. See #756.

This commit is contained in:
Dion Moult
2020-01-13 17:35:56 +11:00
parent 9ef9498c35
commit c4af52e8ee
10 changed files with 2112 additions and 472 deletions
+33
View File
@@ -0,0 +1,33 @@
import os
import json
import ifcopenshell
cwd = os.path.dirname(os.path.realpath(__file__))
class IfcSchema():
def __init__(self):
self.schema_dir = os.path.join(cwd, 'schema') # TODO: make configurable
self.products = ['IfcElement', 'IfcSpatialStructureElement', 'IfcStructural']
self.elements = {}
print(os.path.join(self.schema_dir, 'IFC4_ADD2.ifc'))
self.property_file = ifcopenshell.open(os.path.join(self.schema_dir, 'IFC4_ADD2.ifc'))
self.psets = {}
self.qtos = {}
self.load()
def load(self):
for product in self.products:
with open(os.path.join(self.schema_dir, f'{product}_IFC4.json')) as f:
setattr(self, product, json.load(f))
self.elements.update(getattr(self, product))
with open(os.path.join(self.schema_dir, 'ifc_types_IFC4.json')) as f:
self.type_map = json.load(f)
for property in self.property_file.by_type('IfcPropertySetTemplate'):
if property.Name[0:4] == 'Qto_':
# self.qtos.append({ })
pass
else:
self.psets[property.Name] = {
'HasPropertyTemplates': {p.Name: p for p in property.HasPropertyTemplates}}