mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
ifcfm - move preset searching logic from ifcm to bonsai
So anyone using 'python -m ifcfm' will get more readable error for invalid presets.
This commit is contained in:
@@ -36,13 +36,9 @@ class FMData:
|
||||
cls.data["engine"] = cls.engine()
|
||||
|
||||
@classmethod
|
||||
def engine(cls):
|
||||
def engine(cls) -> list[tuple[str, str, str]]:
|
||||
results = []
|
||||
fm_dir = os.path.dirname(ifcfm.__file__)
|
||||
for f in os.listdir(fm_dir):
|
||||
if f.endswith(".py") and not f.startswith("_"):
|
||||
preset = os.path.splitext(f)[0]
|
||||
module = importlib.import_module(f"ifcfm.{preset}")
|
||||
config = getattr(module, "config")
|
||||
results.append((preset, config["name"], config["description"]))
|
||||
presets = ifcfm.get_presets_configs()
|
||||
for preset, config in presets.items():
|
||||
results.append((preset, config["name"], config["description"]))
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user