working stl and json save
parent
4e0706211f
commit
138d8ec091
|
@ -25,7 +25,6 @@
|
||||||
<script src="app.bundle.js"></script>
|
<script src="app.bundle.js"></script>
|
||||||
<script src="scene.bundle.js"></script>
|
<script src="scene.bundle.js"></script>
|
||||||
<script src="solver.js"></script>
|
<script src="solver.js"></script>
|
||||||
<script src="lz-string.min.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -280,14 +280,7 @@ class Sketch {
|
||||||
this.deleteSelected()
|
this.deleteSelected()
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
var string = JSON.stringify(this.toJSON());
|
console.log('undo would be nice')
|
||||||
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);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,15 @@ function save(blob, filename) {
|
||||||
|
|
||||||
function saveArrayBuffer( buffer, 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 ) {
|
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() {
|
export function savePart() {
|
||||||
const string = sc.saveString()
|
|
||||||
|
|
||||||
saveString( LZString.compress(string), 'test2.bin' );
|
saveString( sc.saveString(), 'uncomp.json' );
|
||||||
|
|
||||||
}
|
}
|
1
todo.txt
1
todo.txt
|
@ -56,6 +56,7 @@ add cancle soft button for line arc
|
||||||
auto snap
|
auto snap
|
||||||
constraint labels,equal
|
constraint labels,equal
|
||||||
|
|
||||||
|
add download button, different from save button
|
||||||
parallel // need to add antoher button to feature ,or empty placeholder
|
parallel // need to add antoher button to feature ,or empty placeholder
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue