This commit is contained in:
Andrej730
2024-04-08 15:05:37 +05:00
parent 9ef63e9b04
commit bc8b4e1a69
3 changed files with 18 additions and 5 deletions
+3
View File
@@ -18,8 +18,11 @@
import bpy import bpy
import ifcopenshell import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.representation import ifcopenshell.util.representation
import ifcopenshell.util.element
import blenderbim.core.tool import blenderbim.core.tool
import blenderbim.core.aggregate
import blenderbim.core.geometry import blenderbim.core.geometry
import blenderbim.core.material import blenderbim.core.material
import blenderbim.core.style import blenderbim.core.style
@@ -23,14 +23,19 @@ import numpy
import importlib import importlib
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
from typing import Callable, Any from typing import Callable, Any, Optional
pre_listeners = {} pre_listeners = {}
post_listeners = {} post_listeners = {}
def run(usecase_path: str, ifc_file: ifcopenshell.file = None, should_run_listeners=True, **settings) -> Any: def run(
usecase_path: str,
ifc_file: Optional[ifcopenshell.file] = None,
should_run_listeners=True,
**settings: Any,
) -> Any:
if should_run_listeners: if should_run_listeners:
for listener in pre_listeners.get(usecase_path, {}).values(): for listener in pre_listeners.get(usecase_path, {}).values():
listener(usecase_path, ifc_file, settings) listener(usecase_path, ifc_file, settings)
+8 -3
View File
@@ -28,7 +28,7 @@ import numbers
import zipfile import zipfile
import functools import functools
from pathlib import Path from pathlib import Path
from typing import Tuple, List from typing import List, Optional
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.file import ifcopenshell.util.file
@@ -199,7 +199,12 @@ class file(object):
wrapped_data: ifcopenshell_wrapper.file wrapped_data: ifcopenshell_wrapper.file
def __init__(self, f: ifcopenshell_wrapper.file = None, schema: str = None, schema_version: Tuple[int] = None): def __init__(
self,
f: Optional[ifcopenshell_wrapper.file] = None,
schema: Optional[str] = None,
schema_version: Optional[tuple[int, int, int, int]] = None,
):
"""Create a new blank IFC model """Create a new blank IFC model
This IFC model does not have any entities in it yet. See the This IFC model does not have any entities in it yet. See the
@@ -223,7 +228,7 @@ class file(object):
ADD2 TC1, which is the official version approved by ISO when people ADD2 TC1, which is the official version approved by ISO when people
refer to "IFC4". Generally you should not use this argument unless refer to "IFC4". Generally you should not use this argument unless
you are testing non-ISO IFC releases. you are testing non-ISO IFC releases.
:type schema_version: tuple[int] :type schema_version: tuple[int, int, int, int]
Example: Example: