(args, extra_args)
| 176 | |
| 177 | |
| 178 | def cmd_quantify(args, extra_args): |
| 179 | if args.quantify_command == "list": |
| 180 | result = list_rules() |
| 181 | print(format_output(result, args.output_format)) |
| 182 | elif args.quantify_command == "run": |
| 183 | try: |
| 184 | model = ifcopenshell.open(args.ifc_file) |
| 185 | except Exception as e: |
| 186 | print(f"Error: Could not open IFC file: {e}", file=sys.stderr) |
| 187 | sys.exit(1) |
| 188 | selector = args.selector or None |
| 189 | result = run_quantify(model, args.rule_name, selector=selector) |
| 190 | if result["ok"]: |
| 191 | output_path = args.output or args.ifc_file |
| 192 | model.write(output_path) |
| 193 | print(format_output(result, args.output_format)) |
| 194 | if not result["ok"]: |
| 195 | sys.exit(1) |
| 196 | else: |
| 197 | print("Error: quantify requires a subcommand: list or run", file=sys.stderr) |
| 198 | sys.exit(1) |
| 199 | |
| 200 | |
| 201 | def main(): |
no test coverage detected