diff --git a/src/ifctester/ifctester/__main__.py b/src/ifctester/ifctester/__main__.py index a61e2e0b7d..b9ab913813 100644 --- a/src/ifctester/ifctester/__main__.py +++ b/src/ifctester/ifctester/__main__.py @@ -23,6 +23,7 @@ import argparse import ifcopenshell from . import ids from . import reporter +from pathlib import Path parser = argparse.ArgumentParser(description="Uses an IDS to audit an IFC") parser.add_argument("ids", type=str, help="Path to an IDS") @@ -33,10 +34,19 @@ parser.add_argument("--excel-safe", help="Make sure exported ODS is safely expor parser.add_argument("-o", "--output", help="Output file (supported for all types of reporting except Console)") args = parser.parse_args() -specs = ids.open(args.ids) +ids_path = Path(args.ids) +if ids_path.suffix.lower() != ".ids": + raise Exception(f"Provided file is not an .ids file: '{ids_path}'.") + +ifc_patch = Path(args.ifc) +if ifc_patch.suffix.lower() != ".ifc": + raise Exception(f"Provided file is not an .ifc file: '{ifc_patch}'.") + +specs = ids.open(str(ids_path)) if args.ifc: start = time.time() - ifc = ifcopenshell.open(args.ifc) + ifc = ifcopenshell.open(ifc_patch) + assert isinstance(ifc, ifcopenshell.file) print("Finished loading:", time.time() - start) start = time.time() specs.validate(ifc)