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
@@ -20,28 +20,25 @@ import ifcopenshell
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, structural_analysis_model=None):
"""Removes an analysis model
def remove_structural_analysis_model(file, structural_analysis_model=None) -> None:
"""Removes an analysis model
Note that the contents of an analysis model are currently preserved.
Note that the contents of an analysis model are currently preserved.
:param structural_analysis_model: The IfcStructuralAnalysisModel to
remove.
:type structural_analysis_model: ifcopenshell.entity_instance
:return: None
:rtype: None
"""
self.file = file
self.settings = {"structural_analysis_model": 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}
def execute(self):
for rel in self.settings["structural_analysis_model"].IsGroupedBy or []:
history = rel.OwnerHistory
self.file.remove(rel)
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)
history = self.settings["structural_analysis_model"].OwnerHistory
self.file.remove(self.settings["structural_analysis_model"])
for rel in settings["structural_analysis_model"].IsGroupedBy or []:
history = rel.OwnerHistory
file.remove(rel)
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)
ifcopenshell.util.element.remove_deep2(file, history)
history = settings["structural_analysis_model"].OwnerHistory
file.remove(settings["structural_analysis_model"])
if history:
ifcopenshell.util.element.remove_deep2(file, history)