MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / OpenModel

Method OpenModel

src/ts/web-ifc-api.ts:478–503  ·  view source on GitHub ↗

* Opens a model and returns a modelID number * @param data Buffer containing IFC data (bytes) * @param settings Settings for loading the model @see LoaderSettings * @returns ModelID or -1 if model fails to open

(data: Uint8Array, settings?: LoaderSettings)

Source from the content-addressed store, hash-verified

476 * @returns ModelID or -1 if model fails to open
477 */
478 OpenModel(data: Uint8Array, settings?: LoaderSettings): number {
479 let s = this.CreateSettings(settings);
480 let result = this.wasmModule.OpenModel(
481 s,
482 (destPtr: number, offsetInSrc: number, destSize: number) => {
483 let srcSize = Math.min(data.byteLength - offsetInSrc, destSize);
484 let dest = this.wasmModule.HEAPU8.subarray(destPtr, destPtr + srcSize);
485 let src = data.subarray(offsetInSrc, offsetInSrc + srcSize);
486 dest.set(src);
487 return srcSize;
488 }
489 );
490 this.deletedLines.set(result, new Set());
491 var schemaName = this.GetHeaderLine(result, FILE_SCHEMA).arguments[0][0]
492 .value;
493 let id = this.LookupSchemaId(schemaName);
494 if (id == -1) {
495 Log.error("Unsupported Schema:" + schemaName);
496 this.CloseModel(result);
497 return -1;
498 }
499 this.modelSchemaList[result] = id;
500 this.modelSchemaNameList[result] = schemaName;
501 Log.debug("Parsing Model using " + schemaName + " Schema");
502 return result;
503 }
504
505 /**
506 * Opens a model and returns a modelID number

Callers 11

OpenModelsMethod · 0.95
WithIFCFileLoadedFunction · 0.95
OpenModelFromCallbackMethod · 0.80
BenchmarkIfcFileFunction · 0.80
CreateModelResutsFunction · 0.80
WebIfcApi.spec.tsFile · 0.80
Columns.spec.tsFile · 0.80
Properties.spec.tsFile · 0.80
runCodeFunction · 0.80
LoadModelFunction · 0.80
LoadFileFunction · 0.80

Calls 4

CreateSettingsMethod · 0.95
GetHeaderLineMethod · 0.95
LookupSchemaIdMethod · 0.95
CloseModelMethod · 0.95

Tested by

no test coverage detected