mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
typing
This commit is contained in:
@@ -17,5 +17,14 @@
|
|||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# 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)
|
patch.run_migrate_patch(infile, outfile, schema)
|
||||||
|
|||||||
@@ -19,15 +19,22 @@
|
|||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import blenderbim.core.tool
|
import blenderbim.core.tool
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ifcpatch
|
import ifcpatch
|
||||||
except:
|
except ImportError:
|
||||||
print("IfcPatch not available")
|
print("IfcPatch not available")
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import ifcpatch
|
||||||
|
|
||||||
|
|
||||||
class Patch(blenderbim.core.tool.Patch):
|
class Patch(blenderbim.core.tool.Patch):
|
||||||
@classmethod
|
@classmethod
|
||||||
def run_migrate_patch(cls, infile, outfile, 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]})
|
output = ifcpatch.execute(
|
||||||
|
{"input": infile, "file": ifcopenshell.open(infile), "recipe": "Migrate", "arguments": [schema]}
|
||||||
|
)
|
||||||
ifcpatch.write(output, outfile)
|
ifcpatch.write(output, outfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user