This commit is contained in:
Andrej730
2026-03-03 14:34:05 +05:00
parent 619848823c
commit 8743d5643e
7 changed files with 70 additions and 36 deletions
@@ -17,21 +17,24 @@
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
import logging
import tempfile
import ifcopenshell.util.element
import ifcpatch
try:
import sqlite3
except:
print("No SQLite support")
class Patcher:
class Patcher(ifcpatch.BasePatcher):
def __init__(
self,
file,
logger,
file: ifcopenshell.file,
logger: logging.Logger | None = None,
):
"""Extracts properties and relationships from a IFC-SPF model to SQLite.
@@ -45,10 +48,11 @@ class Patcher:
result = ifcpatch.execute({"input": fn, "file": model, "recipe": "ExtractPropertiesToSQLite"})
ifcpatch.write(result, "output.sqlite")
"""
self.file = file
self.logger = logger
super().__init__(file, logger)
def patch(self):
import sqlite3
tmp = tempfile.NamedTemporaryFile(delete=False)
db_file = tmp.name
self.db = sqlite3.connect(db_file)
-1
View File
@@ -125,7 +125,6 @@ class Patcher(ifcpatch.BasePatcher):
)
"""
super().__init__(file, logger)
self.logger = logger
self.sql_type: Literal["sqlite", "mysql"] = sql_type.lower()
self.host = host
self.username = username