Add stl export

This commit is contained in:
casperlamboo 2017-10-24 16:56:30 +02:00
parent ac98aaee5c
commit 65e4f230b0
3 changed files with 106 additions and 1546 deletions

1625
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
"dependencies": {
"@doodle3d/cal": "0.0.8",
"@doodle3d/clipper-js": "^1.0.7",
"@doodle3d/threejs-export-stl": "0.0.3",
"babel-plugin-inline-import": "^2.0.6",
"imports-loader": "^0.7.1",
"memoizee": "^0.3.9",

View File

@ -1,5 +1,5 @@
import { Matrix } from '@doodle3d/cal';
// import * as exportSTL from '@doodle3d/threejs-export-stl';
import * as exportSTL from '@doodle3d/threejs-export-stl';
// import * as exportOBJ from '@doodle3d/threejs-export-obj';
import * as THREE from 'three';
import ThreeBSP from 'three-js-csg';
@ -124,18 +124,18 @@ export async function createFile(objectsById, type, options) {
const blob = new Blob([string], { type: 'application/json' });
return blob;
}
// case 'stl-string': {
// const string = exportSTL.fromMesh(exportMesh, false);
// return string;
// }
// case 'stl-base64': {
// const buffer = exportSTL.fromMesh(exportMesh, true);
// return bufferToBase64(buffer);
// }
// case 'stl-blob': {
// const buffer = exportSTL.fromMesh(exportMesh, true);
// return new Blob([buffer], { type: 'application/vnd.ms-pki.stl' })
// }
case 'stl-string': {
const string = exportSTL.fromMesh(exportMesh, false);
return string;
}
case 'stl-base64': {
const buffer = exportSTL.fromMesh(exportMesh, true);
return bufferToBase64(buffer);
}
case 'stl-blob': {
const buffer = exportSTL.fromMesh(exportMesh, true);
return new Blob([buffer], { type: 'application/vnd.ms-pki.stl' })
}
// case 'obj-blob': {
// const buffer = await exportOBJ.fromMesh(exportMesh, true);
// return buffer;