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,32 +20,29 @@ import ifcopenshell
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, profile=None):
"""Removes a profile
def remove_profile(file, profile=None) -> None:
"""Removes a profile
:param profile: The IfcProfileDef to remove.
:type profile: ifcopenshell.entity_instance
:return: None
:rtype: None
:param profile: The IfcProfileDef to remove.
:type profile: ifcopenshell.entity_instance
:return: None
:rtype: None
Example:
Example:
.. code:: python
.. code:: python
circle = ifcopenshell.api.run("profile.add_parameterized_profile", model,
ifc_class="IfcCircleProfileDef")
circle = 1.
ifcopenshell.api.run("profile.remove_profile", model, profile=circle)
"""
self.file = file
self.settings = {"profile": profile}
circle = ifcopenshell.api.run("profile.add_parameterized_profile", model,
ifc_class="IfcCircleProfileDef")
circle = 1.
ifcopenshell.api.run("profile.remove_profile", model, profile=circle)
"""
settings = {"profile": profile}
def execute(self):
subelements = set()
for attribute in self.settings["profile"]:
if isinstance(attribute, ifcopenshell.entity_instance):
subelements.add(attribute)
self.file.remove(self.settings["profile"])
for subelement in subelements:
ifcopenshell.util.element.remove_deep2(self.file, subelement)
subelements = set()
for attribute in settings["profile"]:
if isinstance(attribute, ifcopenshell.entity_instance):
subelements.add(attribute)
file.remove(settings["profile"])
for subelement in subelements:
ifcopenshell.util.element.remove_deep2(file, subelement)