mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
typing
This commit is contained in:
@@ -27,7 +27,9 @@ from logging import Logger
|
||||
|
||||
|
||||
class Patcher:
|
||||
def __init__(self, src: str, file: ifcopenshell.file, logger: Logger, filepaths: Union[str, ifcopenshell.file]):
|
||||
def __init__(
|
||||
self, src: str, file: ifcopenshell.file, logger: Logger, filepaths: list[Union[str, ifcopenshell.file]]
|
||||
):
|
||||
"""Merge two or more IFC models into one
|
||||
|
||||
Note that other than combining the two (or more) IfcProject elements into
|
||||
@@ -40,7 +42,7 @@ class Patcher:
|
||||
:param filepaths: The filepath(s) of the second (, third, ...) IFC model
|
||||
to merge into the first. The first model is already specified as the
|
||||
input to IfcPatch.
|
||||
:type filepaths: Union[str, ifcopenshell.file]
|
||||
:type filepaths: list[Union[str, ifcopenshell.file]]
|
||||
:filter_glob filepaths: *.ifc;*.ifczip;*.ifcxml
|
||||
|
||||
Example:
|
||||
@@ -60,10 +62,11 @@ class Patcher:
|
||||
other = filepath
|
||||
else:
|
||||
other = ifcopenshell.open(filepath)
|
||||
assert isinstance(other, ifcopenshell.file)
|
||||
|
||||
self.merge(other)
|
||||
|
||||
def merge(self, other):
|
||||
def merge(self, other: ifcopenshell.file) -> None:
|
||||
if (main_unit := self.get_unit_name(self.file)) != self.get_unit_name(other):
|
||||
other = ifcopenshell.util.unit.convert_file_length_units(other, main_unit)
|
||||
|
||||
@@ -128,7 +131,7 @@ class Patcher:
|
||||
length_unit = ifcopenshell.util.unit.get_project_unit(ifc_file, "LENGTHUNIT")
|
||||
return ifcopenshell.util.unit.get_full_unit_name(length_unit)
|
||||
|
||||
def reuse_existing_contexts(self):
|
||||
def reuse_existing_contexts(self) -> None:
|
||||
to_delete = set()
|
||||
|
||||
for added_context in self.added_contexts:
|
||||
|
||||
Reference in New Issue
Block a user