MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / processObject

Function processObject

parse-worker.js:74–100  ·  view source on GitHub ↗
(object, id)

Source from the content-addressed store, hash-verified

72 : await fetchText(url);
73 const object = loader.parse(text);
74 processObject(object, id);
75 } else {
76 throw new Error(`Unsupported file type: ${fileExtension}`);
77 }
78 } catch (error) {
79 self.postMessage({ id, success: false, error: workerErrorMessage(error) });
80 }
81};
82
83const THUMBNAIL_3MF_TARGET_TRIANGLES = 200000;
84const FAST_3MF_XML_BYTES = 2 * 1024 * 1024;
85
86function decodeZipText(bytes) {
87 if (typeof THREE !== 'undefined' && THREE.LoaderUtils && typeof THREE.LoaderUtils.decodeText === 'function') {
88 return THREE.LoaderUtils.decodeText(bytes);
89 }
90 return new TextDecoder().decode(bytes);
91}
92
93function zipKeys(zip) {
94 return zip ? Object.keys(zip) : [];
95}
96
97function shouldUseFast3mfExtract(zip) {
98 const names = zipKeys(zip);
99 const extract = self.ThreeMFMeshExtract;
100 if (extract && typeof extract.zipHasSplitModelParts === 'function' && extract.zipHasSplitModelParts(names)) {
101 return true;
102 }
103 let modelBytes = 0;

Callers 1

parse-worker.jsFile · 0.85

Calls 1

extractGeometryFunction · 0.85

Tested by

no test coverage detected