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,28 +21,25 @@ import ifcopenshell.api
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, relation=None):
"""Removes a relationship between a connection and a condition
def remove_structural_connection_condition(file, relation=None) -> None:
"""Removes a relationship between a connection and a condition
The condition and the member itself is preserved.
The condition and the member itself is preserved.
:param relation: The IfcRelConnectsStructuralMember to remove.
:type relation: ifcopenshell.entity_instance
:return: None
:rtype: None
"""
self.file = file
self.settings = {"relation": relation}
:param relation: The IfcRelConnectsStructuralMember to remove.
:type relation: ifcopenshell.entity_instance
:return: None
:rtype: None
"""
settings = {"relation": relation}
def execute(self):
if self.settings["relation"].AppliedCondition:
ifcopenshell.api.run(
"structural.remove_structural_boundary_condition",
self.file,
connection=self.settings["relation"].RelatedStructuralConnection
)
history = self.settings["relation"].OwnerHistory
self.file.remove(self.settings["relation"])
if history:
ifcopenshell.util.element.remove_deep2(self.file, history)
if settings["relation"].AppliedCondition:
ifcopenshell.api.run(
"structural.remove_structural_boundary_condition",
file,
connection=settings["relation"].RelatedStructuralConnection,
)
history = settings["relation"].OwnerHistory
file.remove(settings["relation"])
if history:
ifcopenshell.util.element.remove_deep2(file, history)