mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
typing
This commit is contained in:
+3
-7
@@ -29,18 +29,14 @@ def remove_structural_analysis_model(
|
||||
|
||||
:param structural_analysis_model: The IfcStructuralAnalysisModel to
|
||||
remove.
|
||||
:type structural_analysis_model: ifcopenshell.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
settings = {"structural_analysis_model": structural_analysis_model}
|
||||
|
||||
for rel in settings["structural_analysis_model"].IsGroupedBy or []:
|
||||
for rel in structural_analysis_model.IsGroupedBy or []:
|
||||
history = rel.OwnerHistory
|
||||
file.remove(rel)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
history = settings["structural_analysis_model"].OwnerHistory
|
||||
file.remove(settings["structural_analysis_model"])
|
||||
history = structural_analysis_model.OwnerHistory
|
||||
file.remove(structural_analysis_model)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
|
||||
+9
-11
@@ -28,23 +28,21 @@ def remove_structural_boundary_condition(
|
||||
|
||||
:param connection: The IfcStructuralConnection to remove the condition
|
||||
from. If omitted, it is assumed to be an orphaned condition.
|
||||
:type connection: ifcopenshell.entity_instance,optional
|
||||
:param boundary_condition: The IfcBoundaryCondition to remove.
|
||||
:type boundary_condition: ifcopenshell.entity_instance, optional.
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
settings = {"connection": connection, "boundary_condition": boundary_condition}
|
||||
|
||||
if settings["connection"]:
|
||||
if connection:
|
||||
# remove boundary condition from a connection
|
||||
if not settings["connection"].AppliedCondition:
|
||||
if not connection.AppliedCondition:
|
||||
return
|
||||
if len(file.get_inverse(settings["connection"].AppliedCondition)) == 1:
|
||||
file.remove(settings["connection"].AppliedCondition)
|
||||
settings["connection"].AppliedCondition = None
|
||||
applied_condition = connection.AppliedCondition
|
||||
if file.get_total_inverses(applied_condition) == 1:
|
||||
file.remove(applied_condition)
|
||||
connection.AppliedCondition = None
|
||||
else:
|
||||
assert boundary_condition, "Either connection or boundary_condition must be provided."
|
||||
# remove the boundary condition
|
||||
for conn in file.get_inverse(settings["boundary_condition"]):
|
||||
for conn in file.get_inverse(boundary_condition):
|
||||
conn.AppliedCondition = None
|
||||
file.remove(settings["boundary_condition"])
|
||||
file.remove(boundary_condition)
|
||||
|
||||
@@ -22,10 +22,6 @@ def remove_structural_load(file: ifcopenshell.file, structural_load: ifcopenshel
|
||||
"""Removes a structural load
|
||||
|
||||
:param structural_load: The IfcStructuralLoad to remove.
|
||||
:type structural_load: ifcopenshell.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
settings = {"structural_load": structural_load}
|
||||
|
||||
file.remove(settings["structural_load"])
|
||||
file.remove(structural_load)
|
||||
|
||||
@@ -25,18 +25,14 @@ def remove_structural_load_case(file: ifcopenshell.file, load_case: ifcopenshell
|
||||
"""Removes a structural load case
|
||||
|
||||
:param load_case: The IfcStructuralLoadCase to remove.
|
||||
:type load_case: ifcopenshell.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
settings = {"load_case": load_case}
|
||||
|
||||
# TODO: do a deep purge
|
||||
for rel in settings["load_case"].IsGroupedBy or []:
|
||||
for rel in load_case.IsGroupedBy or []:
|
||||
history = rel.OwnerHistory
|
||||
file.remove(rel)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
history = settings["load_case"].OwnerHistory
|
||||
file.remove(settings["load_case"])
|
||||
history = load_case.OwnerHistory
|
||||
file.remove(load_case)
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
|
||||
@@ -25,20 +25,16 @@ def remove_structural_load_group(file: ifcopenshell.file, load_group: ifcopenshe
|
||||
"""Removes a structural load group
|
||||
|
||||
:param load_group: The IfcStructuralLoadGroup to remove.
|
||||
:type load_group: ifcopenshell.entity_instance
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
settings = {"load_group": load_group}
|
||||
|
||||
# TODO: do a deep purge
|
||||
for inverse in file.get_inverse(settings["load_group"]):
|
||||
for inverse in file.get_inverse(load_group):
|
||||
if inverse.is_a("IfcRelAssignsToGroup") and len(inverse.RelatedObjects) == 1:
|
||||
history = inverse.OwnerHistory
|
||||
file.remove(inverse)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
history = settings["load_group"].OwnerHistory
|
||||
file.remove(settings["load_group"])
|
||||
history = load_group.OwnerHistory
|
||||
file.remove(load_group)
|
||||
if history:
|
||||
ifcopenshell.util.element.remove_deep2(file, history)
|
||||
|
||||
Reference in New Issue
Block a user