mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 12:27:56 +01:00
added more pokemon
This commit is contained in:
parent
f2327d3a21
commit
20374b9e6b
BIN
models/pokemon/bulbasaur.stl
Normal file
BIN
models/pokemon/bulbasaur.stl
Normal file
Binary file not shown.
BIN
models/pokemon/charmander.stl
Normal file
BIN
models/pokemon/charmander.stl
Normal file
Binary file not shown.
BIN
models/pokemon/squirtle.stl
Normal file
BIN
models/pokemon/squirtle.stl
Normal file
Binary file not shown.
153932
models/robot.stl
Normal file
153932
models/robot.stl
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
|||||||
"printer.firstLayerSlow": true,
|
"printer.firstLayerSlow": true,
|
||||||
"printer.layerHeight": 0.2,
|
"printer.layerHeight": 0.2,
|
||||||
"printer.retraction.amount": 3,
|
"printer.retraction.amount": 3,
|
||||||
"printer.retraction.enabled": false,
|
"printer.retraction.enabled": true,
|
||||||
"printer.retraction.speed": 50,
|
"printer.retraction.speed": 50,
|
||||||
"printer.retraction.minDistance": 5,
|
"printer.retraction.minDistance": 5,
|
||||||
"printer.shellThickness": 0.4,
|
"printer.shellThickness": 0.4,
|
||||||
|
@ -26,7 +26,6 @@ canvas {border: 1px solid black;}
|
|||||||
<canvas id="canvas" width="400" height="400"></canvas>
|
<canvas id="canvas" width="400" height="400"></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var USER_SETTINGS, PRINTER_SETTINGS, doodleBox, gcode;
|
var USER_SETTINGS, PRINTER_SETTINGS, doodleBox, gcode;
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
@ -39,10 +38,10 @@ function init () {
|
|||||||
var printer = new D3D.Printer(USER_SETTINGS, PRINTER_SETTINGS["ultimaker"]);
|
var printer = new D3D.Printer(USER_SETTINGS, PRINTER_SETTINGS["ultimaker"]);
|
||||||
|
|
||||||
var loader = new THREE.STLLoader();
|
var loader = new THREE.STLLoader();
|
||||||
loader.load("models/diamond.stl", function (geometry) {
|
loader.load("models/pokemon/pikachu.stl", function (geometry) {
|
||||||
//var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1);
|
//var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1);
|
||||||
//var geometry = new THREE.SphereGeometry(10, 10, 10);
|
//var geometry = new THREE.SphereGeometry(10, 20, 10);
|
||||||
var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
||||||
/*
|
/*
|
||||||
var geometry = (function () {
|
var geometry = (function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -68,9 +67,10 @@ function init () {
|
|||||||
return geometry;
|
return geometry;
|
||||||
})();
|
})();
|
||||||
*/
|
*/
|
||||||
var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: true});
|
var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false});
|
||||||
var mesh = new THREE.Mesh(geometry, material);
|
var mesh = new THREE.Mesh(geometry, material);
|
||||||
|
|
||||||
|
mesh.rotation.x = -Math.PI/2;
|
||||||
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
|
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
|
||||||
mesh.position.x = 100;
|
mesh.position.x = 100;
|
||||||
mesh.position.z = 100;
|
mesh.position.z = 100;
|
||||||
@ -165,7 +165,7 @@ function createScene () {
|
|||||||
function loaded () {
|
function loaded () {
|
||||||
loadedItems ++;
|
loadedItems ++;
|
||||||
if (loadedItems === 2) {
|
if (loadedItems === 2) {
|
||||||
//init();
|
init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,10 +107,10 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
|
|||||||
var layersIntersections = [];
|
var layersIntersections = [];
|
||||||
|
|
||||||
for (var lineIndex = 0; lineIndex < this.lines.length; lineIndex ++) {
|
for (var lineIndex = 0; lineIndex < this.lines.length; lineIndex ++) {
|
||||||
var line = this.lines[lineIndex];
|
var line = this.lines[lineIndex].line;
|
||||||
|
|
||||||
var min = Math.ceil(Math.min(line.line.start.y, line.line.end.y) / layerHeight);
|
var min = Math.ceil(Math.min(line.start.y, line.end.y) / layerHeight);
|
||||||
var max = Math.floor(Math.max(line.line.start.y, line.line.end.y) / layerHeight);
|
var max = Math.floor(Math.max(line.start.y, line.end.y) / layerHeight);
|
||||||
|
|
||||||
for (var layerIndex = min; layerIndex <= max; layerIndex ++) {
|
for (var layerIndex = min; layerIndex <= max; layerIndex ++) {
|
||||||
if (layerIndex >= 0) {
|
if (layerIndex >= 0) {
|
||||||
@ -285,9 +285,9 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
|||||||
}
|
}
|
||||||
var upSkin = new D3D.Paths([], true);
|
var upSkin = new D3D.Paths([], true);
|
||||||
if (layer + topSkinCount < slices.length) {
|
if (layer + topSkinCount < slices.length) {
|
||||||
var downLayer = slices[layer + topSkinCount];
|
var upLayer = slices[layer + topSkinCount];
|
||||||
for (var i = 0; i < downLayer.length; i ++) {
|
for (var i = 0; i < upLayer.length; i ++) {
|
||||||
upSkin.join(downLayer[i]);
|
upSkin.join(upLayer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var surroundingLayer = upSkin.intersect(downSkin).scaleUp(scale);
|
var surroundingLayer = upSkin.intersect(downSkin).scaleUp(scale);
|
||||||
@ -392,15 +392,15 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
|
|||||||
var retractionMinDistance = printer.config["printer.retraction.minDistance"];
|
var retractionMinDistance = printer.config["printer.retraction.minDistance"];
|
||||||
var retractionAmount = printer.config["printer.retraction.amount"];
|
var retractionAmount = printer.config["printer.retraction.amount"];
|
||||||
|
|
||||||
function sliceToGcode (slice) {
|
function sliceToGcode (path) {
|
||||||
var gcode = [];
|
var gcode = [];
|
||||||
|
|
||||||
for (var i = 0; i < slice.length; i ++) {
|
for (var i = 0; i < path.length; i ++) {
|
||||||
var shape = slice[i];
|
var shape = path[i];
|
||||||
|
|
||||||
var previousPoint;
|
var previousPoint;
|
||||||
|
|
||||||
var length = slice.closed ? (shape.length + 1) : shape.length;
|
var length = path.closed ? (shape.length + 1) : shape.length;
|
||||||
|
|
||||||
for (var j = 0; j < length; j ++) {
|
for (var j = 0; j < length; j ++) {
|
||||||
var point = shape[j % shape.length];
|
var point = shape[j % shape.length];
|
||||||
@ -408,13 +408,6 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
|
|||||||
if (j === 0) {
|
if (j === 0) {
|
||||||
//TODO
|
//TODO
|
||||||
//add retraction
|
//add retraction
|
||||||
if (extruder > retractionMinDistance && retractionEnabled) {
|
|
||||||
gcode.push([
|
|
||||||
"G0",
|
|
||||||
"E" + (extruder - retractionAmount).toFixed(3),
|
|
||||||
"F" + (retractionSpeed * 60).toFixed(3)
|
|
||||||
].join(" "));
|
|
||||||
}
|
|
||||||
|
|
||||||
gcode.push([
|
gcode.push([
|
||||||
"G0",
|
"G0",
|
||||||
@ -422,13 +415,15 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
|
|||||||
"F" + (travelSpeed * 60)
|
"F" + (travelSpeed * 60)
|
||||||
].join(" "));
|
].join(" "));
|
||||||
|
|
||||||
if (extruder > retractionMinDistance && retractionEnabled) {
|
|
||||||
|
if (extruder > retractionMinDistance && retractionEnabled && j === 0) {
|
||||||
gcode.push([
|
gcode.push([
|
||||||
"G0",
|
"G0",
|
||||||
"E" + extruder.toFixed(3),
|
"E" + extruder.toFixed(3),
|
||||||
"F" + (retractionSpeed * 60).toFixed(3)
|
"F" + (retractionSpeed * 60).toFixed(3)
|
||||||
].join(" "));
|
].join(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var a = new THREE.Vector2(point.X, point.Y);
|
var a = new THREE.Vector2(point.X, point.Y);
|
||||||
@ -449,6 +444,14 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extruder > retractionMinDistance && retractionEnabled) {
|
||||||
|
gcode.push([
|
||||||
|
"G0",
|
||||||
|
"E" + (extruder - retractionAmount).toFixed(3),
|
||||||
|
"F" + (retractionSpeed * 60).toFixed(3)
|
||||||
|
].join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user