-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3MF loader: Cannot read properties of undefined (reading 'target') #27947
Comments
It seems something in your 3MF asset is missing. Normally, there should be a relationship definition that points to the 3D payload. All test assets in our repository have such a definition. The 3MF spec says:
If you rename one of the assets in this repo (e.g. Maybe the exported 3MF is not 100% spec compliant? |
@Mugen87 thanks, I thought it might be (though maybe we could improve the error) @hrgdavor is this a import { to3dmodel } from "@jscadui/3mf-export";
const to3mf: To3MF = {
meshes: [],
components: [],
items: [],
precision: 7,
header: {
unit: "millimeter",
title: "...",
description: "...",
application: "...",
},
};
to3mf.meshes.push({ vertices: someVertices, indices: someIndices, id: "0" });
to3mf.items.push({ objectID: "0" });
const model = to3dmodel(to3mf);
const files: Zippable = {};
files["3D/3dmodel.model"] = strToU8(model);
const zipFile = zipSync(files); If this is a edit: probably here |
To clarify: The problem is that the zip file you are creating does not contain the |
Right, sorry I wasn't clear. I was/am not sure whether the From a quick look at the spec I could not find any mentions of the I have no experience with 3MF beyond basic export/import workflows, apologies if the solution is obvious! |
@nmattia you are missing that is the generator for the mentioned // give the location of the 3d model
fileForRelThumbnail.add3dModel('3D/3dmodel.model') I would advise to add also add the file for content types to make sure you are closer to spec let staticFiles = [fileForContentTypes, fileForRelThumbnail]
staticFiles.forEach(({ name, content }) => addToZip(zip, name, content)) |
Yes that would be great! Handling the error situation more gracefully than before makes sense. |
three.js does not do error handling for invalid inputs. That would be a slippery slope. This is a user error. |
@WestLangley I've just thrown a clearer error: #27955 No hard feelings if you close without merging! |
In certain use cases we do validate things and I believe in this use case it makes absolutely sense. So I'm much in favor of the PR. |
Description
I'm getting an error upon loading a 3MF file. I'm not 100% sure the 3MF file is well formed, but it loads fine in PrusaSlicer.
Here's the error:
The 3MF has a single (manifold-3d) mesh and was exported using
3mf-export
. Let me know if I should instead report the error there.This is where the debugger places it:
GitHub won't let me upload a 3MF so I renamed it to
.zip
. See code below for a base64-encoded version.repro.zip
Thank you for three.js!!!
Code
Live example
The text was updated successfully, but these errors were encountered: