working stl and json save
parent
4e0706211f
commit
138d8ec091
|
@ -25,7 +25,6 @@
|
|||
<script src="app.bundle.js"></script>
|
||||
<script src="scene.bundle.js"></script>
|
||||
<script src="solver.js"></script>
|
||||
<script src="lz-string.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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' );
|
||||
|
||||
}
|
Loading…
Reference in New Issue