mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
typing
This commit is contained in:
@@ -1948,6 +1948,7 @@ class AppendInspectedLinkedElement(AppendLibraryElement):
|
|||||||
queried_obj = context.scene.BIMProjectProperties.queried_obj
|
queried_obj = context.scene.BIMProjectProperties.queried_obj
|
||||||
|
|
||||||
ifc_file = tool.Ifc.get()
|
ifc_file = tool.Ifc.get()
|
||||||
|
linked_ifc_file: ifcopenshell.file
|
||||||
linked_ifc_file = ifcopenshell.open(queried_obj["ifc_filepath"])
|
linked_ifc_file = ifcopenshell.open(queried_obj["ifc_filepath"])
|
||||||
if ifc_file.schema_identifier != linked_ifc_file.schema_identifier:
|
if ifc_file.schema_identifier != linked_ifc_file.schema_identifier:
|
||||||
self.report(
|
self.report(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import ifcopenshell.api.owner
|
|||||||
import ifcopenshell.util.unit
|
import ifcopenshell.util.unit
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
import ifcopenshell.util.placement
|
import ifcopenshell.util.placement
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union, Any
|
||||||
|
|
||||||
NPArrayOfFloats = npt.NDArray[np.float64]
|
NPArrayOfFloats = npt.NDArray[np.float64]
|
||||||
|
|
||||||
@@ -46,6 +46,9 @@ def edit_object_placement(
|
|||||||
|
|
||||||
|
|
||||||
class Usecase:
|
class Usecase:
|
||||||
|
file: ifcopenshell.file
|
||||||
|
settings: dict[str, Any]
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
if not hasattr(self.settings["product"], "ObjectPlacement"):
|
if not hasattr(self.settings["product"], "ObjectPlacement"):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -226,6 +226,9 @@ class file:
|
|||||||
units: dict[str, entity_instance] = {}
|
units: dict[str, entity_instance] = {}
|
||||||
history_size: int = 64
|
history_size: int = 64
|
||||||
|
|
||||||
|
to_delete: Union[set[ifcopenshell.entity_instance], None] = None
|
||||||
|
"""Entities for batch removal."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
f: Optional[ifcopenshell_wrapper.file] = None,
|
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
|
:param ifc_file: The IFC file object
|
||||||
:return: A newly loaded file with the elements removed.
|
:return: A newly loaded file with the elements removed.
|
||||||
"""
|
"""
|
||||||
|
assert ifc_file.to_delete is not None
|
||||||
ifc_string = ifc_file.to_string()
|
ifc_string = ifc_file.to_string()
|
||||||
lines = iter(ifc_string.split("\n"))
|
lines = iter(ifc_string.split("\n"))
|
||||||
ids_to_delete = iter(sorted([e.id() for e in ifc_file.to_delete]))
|
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:
|
if isinstance(attribute, tuple) and len(attribute) > 10:
|
||||||
subelement[i] = []
|
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)
|
ifc_file.to_delete.update(to_delete)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user