mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
New "remove deep" function in the element util module. See #1228.
This commit is contained in:
@@ -118,6 +118,14 @@ def is_representation_of_context(representation, context, subcontext=None, targe
|
||||
return True
|
||||
|
||||
|
||||
def remove_deep(ifc_file, element):
|
||||
subgraph = list(ifc_file.traverse(element))
|
||||
subgraph_set = set(subgraph)
|
||||
for ref in subgraph[::-1]:
|
||||
if ref.id() and len(set(ifc_file.get_inverse(ref)) - subgraph_set) == 0:
|
||||
ifc_file.remove(ref)
|
||||
|
||||
|
||||
def get_representation(element, context, subcontext=None, target_view=None):
|
||||
if element.is_a("IfcProduct") and element.Representation:
|
||||
for r in element.Representation.Representations:
|
||||
|
||||
Reference in New Issue
Block a user