Generate functions for all API usecases for better static code features. See #2693.

This commit is contained in:
Dion Moult
2024-05-06 14:35:39 +10:00
parent 10f894e2ea
commit d11ec67129
330 changed files with 13283 additions and 13751 deletions
@@ -21,25 +21,22 @@ import ifcopenshell.api
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, load_case=None):
"""Removes a structural load case
def remove_structural_load_case(file, load_case=None) -> None:
"""Removes a structural load case
:param load_case: The IfcStructuralLoadCase to remove.
:type load_case: ifcopenshell.entity_instance
:return: None
:rtype: None
"""
self.file = file
self.settings = {"load_case": load_case}
:param load_case: The IfcStructuralLoadCase to remove.
:type load_case: ifcopenshell.entity_instance
:return: None
:rtype: None
"""
settings = {"load_case": load_case}
def execute(self):
# TODO: do a deep purge
for rel in self.settings["load_case"].IsGroupedBy or []:
history = rel.OwnerHistory
self.file.remove(rel)
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)
history = self.settings["load_case"].OwnerHistory
self.file.remove(self.settings["load_case"])
ifcopenshell.util.element.remove_deep2(self.file, history)
# TODO: do a deep purge
for rel in settings["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"])
ifcopenshell.util.element.remove_deep2(file, history)