Repository navigation
Add --preview HTML viewer to scrollcase build - #5
Merged
Merged
Conversation
`scrollcase build --preview` writes <name>-preview.html next to the STLs and opens it. The page embeds every part as one GLB and renders it with three.js from a CDN, with per-part visibility, color and opacity, an explode slider, upright/on-stand poses, a grid toggle, a background color, and a PNG snapshot of the view. trimesh moves from a dev dependency to a runtime one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Write the preview as utf-8 regardless of locale, decode the embedded GLB via fetch, show load failures in the status overlay, and defer revoking the snapshot blob URL so the download can start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scrollcase build --previewwrites<name>-preview.htmlnext to the output STLs and opens it in the default browser. It's a single file with no server: the parts are embedded as one GLB, and three.js loads from jsDelivr, so viewing it needs a network connection.The viewer has:
Upstream villa used the OCP CAD Viewer in VS Code and trimesh's notebook viewer for this; we hadn't ported either.
trimesh moves from a dev dependency to a runtime one. Nothing else is new in
pyproject.toml.Testing
tests/test_preview.pychecks that every part is embedded as a named GLB node in display order, and that the title is escaped in both<title>and the inline JSON.examples/generic.toml(about a 9.7 MB page): opacity fade, explode in both poses, grid toggle, part and background colors, and snapshot output (a valid PNG with no panel). No console errors.🤖 Generated with Claude Code