import os import json import itertools import ifcopenshell import ifcopenshell.util.schema import ifcopenshell.util.attribute import sqlite3 import mysql.connector class Ifc2Sql: def execute(self): self.sql_type = "sqlite" # self.sql_type = "mysql" self.full_schema = False self.is_strict = False self.should_get_psets = True self.should_expand = True self.should_get_geometry_blob = True self.should_skip_geometry_data = True filepath = "/home/dion/test2.ifc" self.file = ifcopenshell.open(filepath) self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(self.file.schema) if self.sql_type == "sqlite": db_file = "/home/dion/test.db" os.remove(db_file) self.db = sqlite3.connect(db_file) elif self.sql_type == "mysql": self.db = mysql.connector.connect( host="localhost", user="root", password="root", database="test" ) self.create_id_map() if self.should_get_psets: self.create_pset_table() if self.full_schema: ifc_classes = [d.name() for d in self.schema.declarations() if str(d).startswith("