Add stl download for OpenSCAD and CadQuery IDEs #331
Reference in New Issue
Block a user
Delete Branch "kurt/330-stl-download"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Everything always takes longer that expected. Few things to note.
ideType === 'openScad'and now more data type === geometry or png, since now openscad can display 3d in preview as well.Some things that are not ideal:
Resolves #330.
This is a bit messy. This is for the OpenSCAD preview, but now it check for both an image cache as well as an stl cache, if it finds either it will return one but with preference for the stl, so that if someone else has cached the 3d output by downloading it than users looking at the preview for the same shape will get the 3d view. It's only if they change the code it will fallback to images again.
I'm not getting console messages from the stl generation, I've had a go a debugging it but it seems like openscad just isn't outputting anything. Might have to dive deeper again later.
@@ -8,1 +8,3 @@import { flow } from 'lodash/fp'import { flow, identity } from 'lodash/fp'import { fileSave } from 'browser-fs-access'import { MeshBasicMaterial, Mesh, Scene } from 'three'nice library that abstracts a bunch browser compatibility issues with saving files from the browser.
more context : https://github.com/zalo/CascadeStudio/pull/39#issuecomment-766911556
@@ -83,0 +95,4 @@)}const handleStlDownload = (({ geometry, fileName, type }) => () => {not needed, but didn't want the
{256 hash}.stlto be the file name, so if there's a comment as the first line it will use that for the title.@@ -19,3 +17,3 @@const mesh = useRef()const ref = useUpdate((geometry) => {geometry.attributes = loadedGeometry.attributesgeometry.attributes = incomingGeo.attributesAsset component is much cleaner now as we're making the three geometry higher in the stack.
pretty messy. this is so that running the stl function rather than preview for openscad when the user want's to download the stl.
@@ -83,0 +86,4 @@return createHealthyResponse({type: 'geometry',data: geometry,consoleMessage: data.consoleMessage,Previously we were storing the aws url here and than was downloading and managing the geometry, but instead doing that here, it's much easier to grab that geometry again to download the stl
@@ -83,0 +125,4 @@requestRender({state,dispatch,code: state.code,if we're currently showing 3d in the preview than we're golden, if not than it must be openscad, so we should trigger an stl download.