From 810f42ea24954b3fe4ebd84e5be981af51cb9c66 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 24 Sep 2024 14:08:43 +0500 Subject: [PATCH] ifc2sql - clarify how output works in docs, add a suffix to temp file --- src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py index 1b27ba3433..f9bbdc9254 100644 --- a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py +++ b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py @@ -93,8 +93,10 @@ class Patcher: .. code:: python - # Convert to SQLite - ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]}) + # Convert to SQLite, SQLite databse will be saved to a temporary file. + sqlite_temp_filepath = ifcpatch.execute( + {"input": "input.ifc", "file": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]} + ) """ self.src = src self.file = file @@ -117,7 +119,7 @@ class Patcher: self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(self.file.schema) if self.sql_type == "sqlite": - tmp = tempfile.NamedTemporaryFile(delete=False) + tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ifcsqlite") db_file = tmp.name self.db = sqlite3.connect(db_file) self.c = self.db.cursor()