download filename is based on scad filename

This commit is contained in:
Kyle Davis 2023-07-02 12:22:11 -06:00
commit 1d4911c153

View file

@ -15,8 +15,9 @@ import { confirmDialog } from 'primereact/confirmdialog';
function downloadOutput(state: State) { function downloadOutput(state: State) {
if (!state.output) return; if (!state.output) return;
const sourcePathParts = state.params.sourcePath.split('/');
const fileName = state.output!.isPreview ? 'preview.stl' : 'render.stl'; const sourceFileName = sourcePathParts.slice(-1)[0];
const fileName = [sourceFileName, state.output!.isPreview ? 'preview.stl' : 'render.stl'].join('.');
const doDownload = () => { const doDownload = () => {
const a = document.createElement('a') const a = document.createElement('a')
a.href = state.output!.stlFileURL a.href = state.output!.stlFileURL