This commit is contained in:
Andrej730
2025-01-28 14:59:01 +05:00
parent 7b94a8d1f5
commit c0306fc729
4 changed files with 10 additions and 2 deletions
@@ -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