-
Notifications
You must be signed in to change notification settings - Fork 114
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
add thumbnail file to 3mf output #626
Conversation
I believe that comes from the OPC spec and is referenced in the 3MF spec in 2.1.1. 3D Parts and Payload Relationships. This declares a mandatory relationship to the 3D Model part, so the minimal content of that file is a single entry like:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was trying to figure out why nothing but Cura wanted to import our 3MFs. Apparently I forgot this in the intervening 8 years since I was writing that spec...
Huh, looks like Github is struggling today - our CI is mysteriously skipping jobs and my avatar icon is wrong. Hopefully it'll sort itself out... |
I think the skipped jobs are due to this PR being a draft PR when I initially opened it. Should now be fixed. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #626 +/- ##
=======================================
Coverage 91.40% 91.40%
=======================================
Files 35 35
Lines 4512 4512
=======================================
Hits 4124 4124
Misses 388 388 ☔ View full report in Codecov by Sentry. |
This should not work. If you look at the example in you need to take image from canvas form util like: /** //example how to generate thumb from canvas and add it in fflate
const pngPreviewFile = new fflate.ZipPassThrough('Metadata/thumbnail.png');
zip.add(pngPreviewFile);
pngPreviewFile.push(cavassToPngA8(canvas), true);
*/
function cavassToPngA8(canvas) {
let url = canvas.toDataURL('image/png')
url = url.substring(url.indexOf(',') + 1)
// strToU8 function from fflate
return strToU8(url)
// string to Uint8Array taken from stackoverflow, and should work in browser
return new Uint8Array(
atob(url)
.split('')
.map(c => c.charCodeAt(0)),
)
} notice 2 return return statements, use only one |
Ah, I need to check to see if it works, I didn't run the js, I just figured out we need a file in that location to make the 3mf recognizable from other programs. Thanks for the reminder. |
add _rel to 3mf output
For some reason files without
_rel/.rels
cannot be imported into openscad. Seems like an issue with lib3mf, not sure if it is stated in the standard or not.