ifcpatch.recipes.Ifc2Sql

Module Contents

class ifcpatch.recipes.Ifc2Sql.Patcher(src, file, logger, sql_type: str = 'sqlite', host: str = 'localhost', username: str = 'root', password: str = 'pass', database: str = 'test')

Convert an IFC-SPF model to SQLite or MySQL.

There are certain controls which are hardcoded in this recipe that you may modify, including:

  • full_schema: if True, will create tables for all IFC classes, regardless if they are used or not in the dataset. If False, will only create tables for classes in the dataset.

  • is_strict: whether or not to enforce null or not null. If your dataset might contain invalid data, set this to False.

  • should_expand: if True, entities with attributes containing lists of entities will be separated into multiple rows. This means the ifc_id is no longer a unique primary key. If False, lists will be stored as JSON.

  • should_get_psets: if True, a separate psets table will be created to make it easy to query properties. This is in addition to regular IFC tables like IfcPropertySet.

  • should_get_geometry: Whether or not to process and store explicit geometry data as a blob in a separate geometry and shape table.

  • should_skip_geometry_data: Whether or not to also create tables for IfcRepresentation and IfcRepresentationItem classes. These tables are unnecessary if you are not interested in geometry.

Parameters:

sql_type (str) – Choose between “sqlite” or “mysql”

Example:

# Convert to SQLite
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]})
create_geometry()
create_geometry_table()
create_id_map()
create_metadata()
create_mysql_table(ifc_class, declaration)
create_pset_table()
create_sqlite_table(ifc_class, declaration)
get_permutations(lst, indexes)
insert_data(ifc_class)
is_entity_list(attribute)
patch()
serialise_value(element, value)