MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / loadIfc

Function loadIfc

src/ifctester/webapp/src/modules/api/api.svelte.ts:122–149  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

120}
121
122export async function loadIfc(file: File): Promise<IfcModel> {
123 try {
124 IFCModels.isLoading = true;
125
126 const arrayBuffer = await file.arrayBuffer();
127 const uint8Array = new Uint8Array(arrayBuffer);
128
129 // Load IFC model
130 const ifcId = await wasm.loadIfc(Array.from(uint8Array)) as string;
131
132 // Add to models list
133 const model: IfcModel = {
134 id: ifcId,
135 fileName: file.name,
136 fileSize: file.size,
137 loadedAt: new Date()
138 };
139 IFCModels.models = [...IFCModels.models, model];
140
141 console.log(`IFC model "${file.name}" loaded with ID: ${ifcId}`);
142 return model;
143 } catch (error) {
144 console.error('Failed to load IFC model:', error);
145 throw error;
146 } finally {
147 IFCModels.isLoading = false;
148 }
149}
150
151export async function unloadIfc(modelId: string) {
152 try {

Callers 1

openIfcFunction · 0.70

Calls 2

loadIfcMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected