mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +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/>.
|
||||
|
||||
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user