mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Generate functions for all API usecases for better static code features. See #2693.
This commit is contained in:
+18
-21
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user