mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 21:47:59 +01:00
add stl loader
This commit is contained in:
parent
0d5587a9c9
commit
7f2b8da15f
@ -1,4 +1,5 @@
|
|||||||
import THREE from 'three.js';
|
import 'three.js';
|
||||||
|
import 'three.js/loaders/STLLoader';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM, { render } from 'react-dom';
|
import ReactDOM, { render } from 'react-dom';
|
||||||
import * as SLICER from 'src/index.js';
|
import * as SLICER from 'src/index.js';
|
||||||
@ -10,8 +11,12 @@ const settings = new SLICER.Settings({
|
|||||||
...SLICER.userSettings
|
...SLICER.userSettings
|
||||||
});
|
});
|
||||||
|
|
||||||
const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
|
const stlLoader = new THREE.STLLoader();
|
||||||
geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(60, 0, 60)));
|
|
||||||
|
stlLoader.load('stl/Airplane.stl', (geometry) => {
|
||||||
|
geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI / -2));
|
||||||
|
geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(50, -0.1, 50)));
|
||||||
|
// geometry.applyMatrix(new THREE.Matrix4().scale(0.8));
|
||||||
geometry.mergeVertices();
|
geometry.mergeVertices();
|
||||||
geometry.computeFaceNormals();
|
geometry.computeFaceNormals();
|
||||||
|
|
||||||
@ -20,5 +25,21 @@ const rawData = generateRawData(geometry, settings);
|
|||||||
render(<SlicerViewer
|
render(<SlicerViewer
|
||||||
layerIntersectionPoints={rawData.layerIntersectionPoints}
|
layerIntersectionPoints={rawData.layerIntersectionPoints}
|
||||||
layerShapes={rawData.layerShapes}
|
layerShapes={rawData.layerShapes}
|
||||||
|
slices={rawData.slices}
|
||||||
settings={settings.config}
|
settings={settings.config}
|
||||||
/>, document.getElementById('container'));
|
/>, document.getElementById('container'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
|
||||||
|
// geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(60, 0, 60)));
|
||||||
|
// geometry.mergeVertices();
|
||||||
|
// geometry.computeFaceNormals();
|
||||||
|
//
|
||||||
|
// const rawData = generateRawData(geometry, settings);
|
||||||
|
//
|
||||||
|
// render(<SlicerViewer
|
||||||
|
// layerIntersectionPoints={rawData.layerIntersectionPoints}
|
||||||
|
// layerShapes={rawData.layerShapes}
|
||||||
|
// slices={rawData.slices}
|
||||||
|
// settings={settings.config}
|
||||||
|
// />, document.getElementById('container'));
|
||||||
|
55582
example/stl/Airplane.stl
Normal file
55582
example/stl/Airplane.stl
Normal file
File diff suppressed because it is too large
Load Diff
94222
example/stl/Rocket.stl
Normal file
94222
example/stl/Rocket.stl
Normal file
File diff suppressed because it is too large
Load Diff
146358
example/stl/castle.stl
Normal file
146358
example/stl/castle.stl
Normal file
File diff suppressed because it is too large
Load Diff
36906
example/stl/traktor.stl
Normal file
36906
example/stl/traktor.stl
Normal file
File diff suppressed because it is too large
Load Diff
@ -137,8 +137,16 @@ SystemJS.config({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
meta: {
|
||||||
|
"three.js/loaders/STLLoader": {
|
||||||
|
"deps": [
|
||||||
|
"three.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
map: {
|
map: {
|
||||||
"babel": "npm:babel-core@5.8.38"
|
"babel": "npm:babel-core@5.8.38",
|
||||||
|
"three.js/loaders/STLLoader": "github:mrdoob/three.js@r75/examples/js/loaders/STLLoader.js",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,6 +43,9 @@
|
|||||||
"vm": "github:jspm/nodelibs-vm@^0.2.0-alpha"
|
"vm": "github:jspm/nodelibs-vm@^0.2.0-alpha"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
"github:mrdoob/three.js@r75": {
|
||||||
|
"format": "global"
|
||||||
|
},
|
||||||
"npm:babel-runtime@5.8.38": {
|
"npm:babel-runtime@5.8.38": {
|
||||||
"main": false,
|
"main": false,
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
|
Loading…
Reference in New Issue
Block a user