This commit is contained in:
Andrej730
2024-07-01 12:05:07 +05:00
parent 8538a916a3
commit f692e943c9
2 changed files with 20 additions and 4 deletions
+10 -1
View File
@@ -17,5 +17,14 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
def run_migrate_patch(patch, infile=None, outfile=None, schema=None):
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
import bpy
import ifcopenshell
import blenderbim.tool as tool
def run_migrate_patch(patch: tool.Patch, infile: str, outfile: str, schema: str) -> None:
patch.run_migrate_patch(infile, outfile, schema)
+10 -3
View File
@@ -19,15 +19,22 @@
import bpy
import ifcopenshell
import blenderbim.core.tool
from typing import TYPE_CHECKING
try:
import ifcpatch
except:
except ImportError:
print("IfcPatch not available")
if TYPE_CHECKING:
import ifcpatch
class Patch(blenderbim.core.tool.Patch):
@classmethod
def run_migrate_patch(cls, infile, outfile, schema):
output = ifcpatch.execute({"input": infile, "file": ifcopenshell.open(infile), "recipe": "Migrate", "arguments": [schema]})
def run_migrate_patch(cls, infile: str, outfile: str, schema: str) -> None:
output = ifcpatch.execute(
{"input": infile, "file": ifcopenshell.open(infile), "recipe": "Migrate", "arguments": [schema]}
)
ifcpatch.write(output, outfile)