New ifcopenshell.api.run syntax, and rename create_product to create_entity. See #1399.

This commit is contained in:
Dion Moult
2021-03-27 22:52:52 +11:00
parent 62540f0b00
commit ce03742aab
44 changed files with 490 additions and 441 deletions
@@ -0,0 +1,11 @@
import importlib
import ifcopenshell.api
def run(usecase_path, ifc_file=None, **settings):
importlib.import_module(f"ifcopenshell.api.{usecase_path}")
module, usecase = usecase_path.split(".")
usecase_class = getattr(getattr(getattr(ifcopenshell.api, module), usecase), "Usecase")
if ifc_file:
return usecase_class(ifc_file, **settings).execute()
return usecase_class(**settings).execute()