diff --git a/src/bonsai/bonsai/tool/cad.py b/src/bonsai/bonsai/tool/cad.py index 8b2b34dae2..62c2b854ab 100644 --- a/src/bonsai/bonsai/tool/cad.py +++ b/src/bonsai/bonsai/tool/cad.py @@ -36,7 +36,7 @@ import bmesh import mathutils.geometry from mathutils import Vector, Matrix, geometry import itertools -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Union if TYPE_CHECKING: from bonsai.bim.module.cad.prop import BIMCadProperties @@ -170,7 +170,9 @@ class Cad: return geometry.intersect_line_plane(v1, v2, plane_co, plane_no) @classmethod - def intersect_edges(cls, edge1, edge2): + def intersect_edges( + cls, edge1: tuple[Vector, Vector], edge2: tuple[Vector, Vector] + ) -> Union[tuple[Vector, Vector], None]: """ > takes 2 tuples, each tuple contains 2 vectors - prepares input for sending to intersect_line_line diff --git a/src/ifcsverchok/helper.py b/src/ifcsverchok/helper.py index edcd723836..61b2b5de45 100644 --- a/src/ifcsverchok/helper.py +++ b/src/ifcsverchok/helper.py @@ -17,13 +17,17 @@ # along with IfcSverchok. If not, see . import bpy +import ifcopenshell from sverchok.data_structure import zip_long_repeat +from typing import Any -ifc_files = {} +ifc_files: dict[str, ifcopenshell.file] = {} class SvIfcCore: - def process(self): + sv_input_names: list[str] + + def process(self) -> None: sv_inputs_nested = [] for name in self.sv_input_names: sv_inputs_nested.append(self.inputs[name].sv_get()) @@ -31,3 +35,6 @@ class SvIfcCore: for sv_input in zip_long_repeat(*sv_input_nested): sv_input = list(sv_input) self.process_ifc(*sv_input) + + def process_ifc(self, *args: Any, **kwargs: Any) -> None: + raise NotImplementedError diff --git a/src/ifcsverchok/nodes/ifc/create_entity.py b/src/ifcsverchok/nodes/ifc/create_entity.py index f17b02a3c0..463154486c 100644 --- a/src/ifcsverchok/nodes/ifc/create_entity.py +++ b/src/ifcsverchok/nodes/ifc/create_entity.py @@ -19,6 +19,7 @@ import bpy from mathutils import Matrix import ifcopenshell +import ifcopenshell.api import ifcsverchok.helper from ifcsverchok.ifcstore import SvIfcStore diff --git a/src/ifcsverchok/nodes/ifc/create_file.py b/src/ifcsverchok/nodes/ifc/create_file.py index f57c9825ed..85794206bf 100644 --- a/src/ifcsverchok/nodes/ifc/create_file.py +++ b/src/ifcsverchok/nodes/ifc/create_file.py @@ -34,6 +34,7 @@ class SvIfcCreateFileRefresh(bpy.types.Operator): has_baked: bpy.props.BoolProperty(name="Has Baked", default=False) def execute(self, context): + node: SvIfcCreateFile node = bpy.data.node_groups[self.tree_name].nodes[self.node_name] node.process() return {"FINISHED"} @@ -55,7 +56,7 @@ class SvIfcCreateFile(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.S self.sv_input_names = ["schema"] super().process() - def process_ifc(self, schema): + def process_ifc(self, schema: str) -> None: guid = ifcopenshell.guid.new() ifcsverchok.helper.ifc_files[guid] = ifcopenshell.file(schema=schema) self.outputs["file"].sv_set([[ifcsverchok.helper.ifc_files[guid]]]) diff --git a/src/ifcsverchok/nodes/ifc/create_project.py b/src/ifcsverchok/nodes/ifc/create_project.py index 3048f7f936..b8f6b3177f 100644 --- a/src/ifcsverchok/nodes/ifc/create_project.py +++ b/src/ifcsverchok/nodes/ifc/create_project.py @@ -52,7 +52,7 @@ class SvIfcCreateProject(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helpe project_name = self.inputs["project_name"].sv_get()[0][0] self.process_ifc(file, project_name) - def process_ifc(self, file, project_name): + def process_ifc(self, file: ifcopenshell.file, project_name: str) -> None: # create project project = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcProject", name=str(project_name)) lengthunit = ifcopenshell.api.run("unit.add_si_unit", file, unit_type="LENGTHUNIT")