Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web-ifc-three/src/IFC/BaseDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,10 @@ export interface WebIfcAPI {
GetFlatMesh(modelID: number, expressID: number): FlatMesh | Promise<FlatMesh>;

SetWasmPath(path: string): void | Promise<void>;

/**
* Creates a map between element ExpressIDs and GlobalIDs.
* Each element has two entries, (ExpressID -> GlobalID) and (GlobalID -> ExpressID).
*/
CreateIfcGuidToExpressIdMapping(modelID: number): void | Promise<void>;
}
4 changes: 3 additions & 1 deletion web-ifc-three/src/IFC/web-workers/BaseDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export enum WorkerActions {
GetNameFromTypeCode = 'GetNameFromTypeCode',
GetIfcEntityList = 'GetIfcEntityList',
GetTypeCodeFromName ='GetTypeCodeFromName',
CreateIfcGuidToExpressIdMapping = 'CreateIfcGuidToExpressIdMapping',

// Parser
parse = 'parse',
Expand Down Expand Up @@ -146,6 +147,7 @@ export interface WebIfcWorkerAPI extends BaseWorkerAPI {
[WorkerActions.GetNameFromTypeCode]: IfcWorkerEventHandler;
[WorkerActions.GetIfcEntityList]: IfcWorkerEventHandler;
[WorkerActions.GetTypeCodeFromName]: IfcWorkerEventHandler;
[WorkerActions.CreateIfcGuidToExpressIdMapping]: IfcWorkerEventHandler;
}

export interface SerializedVector {
Expand All @@ -171,4 +173,4 @@ export const ErrorRootStateNotAvailable = 'The root worker does not have any sta
export const ErrorPropertiesNotAvailable = 'Error: Properties not available from web worker';
export const ErrorParserNotAvailable = 'Error: Parser not available from web worker';
export const ErrorBadJsonPath = 'Error: Model not available from web worker';
export const ErrorBadJson = 'Error: The given Json could not be read as a JS object';
export const ErrorBadJson = 'Error: The given Json could not be read as a JS object';
6 changes: 5 additions & 1 deletion web-ifc-three/src/IFC/web-workers/handlers/WebIfcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export class WebIfcHandler implements WebIfcAPI {
return this.handler.request(this.API, WorkerActions.GetTypeCodeFromName, { typeName });
}

async CreateIfcGuidToExpressIdMapping(modelID: number): Promise<void> {
return this.handler.request(this.API, WorkerActions.CreateIfcGuidToExpressIdMapping, { modelID });
}

async WriteLine(modelID: number, lineObject: any): Promise<void> {
return this.handler.request(this.API, WorkerActions.WriteLine, { modelID, lineObject });
}
Expand Down Expand Up @@ -165,4 +169,4 @@ export class WebIfcHandler implements WebIfcAPI {
async SetWasmPath(path: string): Promise<void> {
return this.handler.request(this.API, WorkerActions.SetWasmPath, { path });
}
}
}
7 changes: 6 additions & 1 deletion web-ifc-three/src/IFC/web-workers/workers/WebIfcWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,13 @@ export class WebIfcWorker implements WebIfcWorkerAPI {
this.worker.post(data);
}

CreateIfcGuidToExpressIdMapping(data: IfcEventData) {
this.webIFC.CreateIfcGuidToExpressIdMapping(data.args.modelID);
this.worker.post(data);
}

private nullifyWebIfc() {
// @ts-ignore
this.webIFC = null;
}
}
}