mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
typing
This commit is contained in:
@@ -22,7 +22,7 @@ import ifcopenshell.api.owner
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.element
|
||||
import ifcopenshell.util.placement
|
||||
from typing import Optional, Union
|
||||
from typing import Optional, Union, Any
|
||||
|
||||
NPArrayOfFloats = npt.NDArray[np.float64]
|
||||
|
||||
@@ -46,6 +46,9 @@ def edit_object_placement(
|
||||
|
||||
|
||||
class Usecase:
|
||||
file: ifcopenshell.file
|
||||
settings: dict[str, Any]
|
||||
|
||||
def execute(self):
|
||||
if not hasattr(self.settings["product"], "ObjectPlacement"):
|
||||
return
|
||||
|
||||
@@ -226,6 +226,9 @@ class file:
|
||||
units: dict[str, entity_instance] = {}
|
||||
history_size: int = 64
|
||||
|
||||
to_delete: Union[set[ifcopenshell.entity_instance], None] = None
|
||||
"""Entities for batch removal."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
f: Optional[ifcopenshell_wrapper.file] = None,
|
||||
|
||||
@@ -1416,6 +1416,7 @@ def unbatch_remove_deep2(ifc_file: ifcopenshell.file) -> ifcopenshell.file:
|
||||
:param ifc_file: The IFC file object
|
||||
:return: A newly loaded file with the elements removed.
|
||||
"""
|
||||
assert ifc_file.to_delete is not None
|
||||
ifc_string = ifc_file.to_string()
|
||||
lines = iter(ifc_string.split("\n"))
|
||||
ids_to_delete = iter(sorted([e.id() for e in ifc_file.to_delete]))
|
||||
@@ -1517,7 +1518,7 @@ def remove_deep2(
|
||||
if isinstance(attribute, tuple) and len(attribute) > 10:
|
||||
subelement[i] = []
|
||||
|
||||
if getattr(ifc_file, "to_delete", None) is not None:
|
||||
if ifc_file.to_delete is not None:
|
||||
ifc_file.to_delete.update(to_delete)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user