(name: string, usageExample: (ifcapi: WebIFC.IfcAPI, modelID: number) => void, settings?: WebIFC.LoaderSettings)
| 7 | let clog = console.log.bind(console); |
| 8 | |
| 9 | export async function WithIFCFileLoaded(name: string, usageExample: (ifcapi: WebIFC.IfcAPI, modelID: number) => void, settings?: WebIFC.LoaderSettings) { |
| 10 | console.log("Start " + chalk.green(`${name}`)); |
| 11 | |
| 12 | console.log = function () { |
| 13 | clog.apply(this, [chalk.gray(`[${name}]:`), ...arguments]); |
| 14 | } |
| 15 | const ifcData = fs.readFileSync(FILE_NAME); |
| 16 | |
| 17 | const ifcapi = new WebIFC.IfcAPI(); |
| 18 | // ifcapi.SetWasmPath("node_modules/web-ifc/"); |
| 19 | ifcapi.SetWasmPath("./"); |
| 20 | await ifcapi.Init(); |
| 21 | |
| 22 | let rawFileData = new Uint8Array(ifcData) |
| 23 | |
| 24 | let modelID = ifcapi.OpenModel(rawFileData, settings); |
| 25 | |
| 26 | let startTime = WebIFC.ms(); |
| 27 | usageExample(ifcapi, modelID); |
| 28 | let endTime = WebIFC.ms(); |
| 29 | |
| 30 | console.log = clog; |
| 31 | |
| 32 | console.log("End " + chalk.green(`${name}`) + chalk.yellow(` (${endTime - startTime} ms elapsed)`)); |
| 33 | |
| 34 | ifcapi.CloseModel(modelID); |
| 35 | } |
| 36 | |
| 37 | export function Equals(name: string, value: any, expectedValue: any) { |
| 38 | if (value !== expectedValue) { |
no test coverage detected