From 138d8ec09150deb7aa413d3ed3dfaae267276912 Mon Sep 17 00:00:00 2001 From: howard Date: Sat, 17 Apr 2021 14:08:14 -0700 Subject: [PATCH] working stl and json save --- dist/index.html | 1 - src/Sketch.js | 9 +-------- src/react/fileExporter.js | 11 ++++++----- todo.txt | 1 + 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/dist/index.html b/dist/index.html index 1ed5ab3..fa709c0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -25,7 +25,6 @@ - \ No newline at end of file diff --git a/src/Sketch.js b/src/Sketch.js index 49cd3cb..c9c866d 100644 --- a/src/Sketch.js +++ b/src/Sketch.js @@ -280,14 +280,7 @@ class Sketch { this.deleteSelected() break; case 'z': - var string = JSON.stringify(this.toJSON()); - window.string = string; - alert("Size of sample is: " + string.length); - window.compressed = LZString.compress(string); - alert("Size of compressed sample is: " + compressed.length); - string = LZString.decompress(compressed); - alert("Sample is: " + string); - + console.log('undo would be nice') break; } } diff --git a/src/react/fileExporter.js b/src/react/fileExporter.js index ce19e82..1e9a465 100644 --- a/src/react/fileExporter.js +++ b/src/react/fileExporter.js @@ -13,13 +13,15 @@ function save(blob, filename) { function saveArrayBuffer( buffer, filename ) { - save( new Blob( [ buffer ], { type: 'application/octet-stream' } ), filename ); + // save( new Blob( [ buffer ], { type: 'application/octet-stream' } ), filename ); + save( new Blob( [ buffer ], { type: 'model/stl' } ), filename ); } function saveString( text, filename ) { - save( new Blob( [ text ], { type: 'text/plain' } ), filename ); + // save( new Blob( [ text ], { type: 'text/plain' } ), filename ); + save( new Blob( [ text ], { type: 'application/json' } ), filename ); } @@ -32,8 +34,7 @@ export function STLExport() { export function savePart() { - const string = sc.saveString() - - saveString( LZString.compress(string), 'test2.bin' ); + + saveString( sc.saveString(), 'uncomp.json' ); } \ No newline at end of file diff --git a/todo.txt b/todo.txt index 8215d91..3c0d59f 100644 --- a/todo.txt +++ b/todo.txt @@ -56,6 +56,7 @@ add cancle soft button for line arc auto snap constraint labels,equal +add download button, different from save button parallel // need to add antoher button to feature ,or empty placeholder