mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-04 21:53:25 +01:00
add stl loader
This commit is contained in:
parent
18456a402a
commit
52e9ba31e0
@ -1,4 +1,5 @@
|
||||
import THREE from 'three.js';
|
||||
import 'three.js';
|
||||
import 'three.js/loaders/STLLoader';
|
||||
import React from 'react';
|
||||
import ReactDOM, { render } from 'react-dom';
|
||||
import * as SLICER from 'src/index.js';
|
||||
@ -10,15 +11,35 @@ const settings = new SLICER.Settings({
|
||||
...SLICER.userSettings
|
||||
});
|
||||
|
||||
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 stlLoader = new THREE.STLLoader();
|
||||
|
||||
const rawData = generateRawData(geometry, settings);
|
||||
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.computeFaceNormals();
|
||||
|
||||
render(<SlicerViewer
|
||||
layerIntersectionPoints={rawData.layerIntersectionPoints}
|
||||
layerShapes={rawData.layerShapes}
|
||||
settings={settings.config}
|
||||
/>, document.getElementById('container'));
|
||||
const rawData = generateRawData(geometry, settings);
|
||||
|
||||
render(<SlicerViewer
|
||||
layerIntersectionPoints={rawData.layerIntersectionPoints}
|
||||
layerShapes={rawData.layerShapes}
|
||||
slices={rawData.slices}
|
||||
settings={settings.config}
|
||||
/>, 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: {
|
||||
"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"
|
||||
},
|
||||
"overrides": {
|
||||
"github:mrdoob/three.js@r75": {
|
||||
"format": "global"
|
||||
},
|
||||
"npm:babel-runtime@5.8.38": {
|
||||
"main": false,
|
||||
"dependencies": {},
|
||||
|
Loading…
Reference in New Issue
Block a user