added more pokemon

This commit is contained in:
casperlamboo 2015-05-26 11:44:15 +02:00
parent f2327d3a21
commit 20374b9e6b
8 changed files with 153960 additions and 25 deletions

Binary file not shown.

Binary file not shown.

BIN
models/pokemon/squirtle.stl Normal file

Binary file not shown.

153932
models/robot.stl Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
"printer.firstLayerSlow": true,
"printer.layerHeight": 0.2,
"printer.retraction.amount": 3,
"printer.retraction.enabled": false,
"printer.retraction.enabled": true,
"printer.retraction.speed": 50,
"printer.retraction.minDistance": 5,
"printer.shellThickness": 0.4,

View File

@ -26,7 +26,6 @@ canvas {border: 1px solid black;}
<canvas id="canvas" width="400" height="400"></canvas>
<script>
var USER_SETTINGS, PRINTER_SETTINGS, doodleBox, gcode;
function init () {
@ -39,10 +38,10 @@ function init () {
var printer = new D3D.Printer(USER_SETTINGS, PRINTER_SETTINGS["ultimaker"]);
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.SphereGeometry(10, 10, 10);
var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
//var geometry = new THREE.SphereGeometry(10, 20, 10);
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
/*
var geometry = (function () {
"use strict";
@ -68,9 +67,10 @@ function init () {
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);
mesh.rotation.x = -Math.PI/2;
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
mesh.position.x = 100;
mesh.position.z = 100;
@ -165,7 +165,7 @@ function createScene () {
function loaded () {
loadedItems ++;
if (loadedItems === 2) {
//init();
init();
}
}

View File

@ -107,10 +107,10 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
var layersIntersections = [];
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 max = Math.floor(Math.max(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.start.y, line.end.y) / layerHeight);
for (var layerIndex = min; layerIndex <= max; layerIndex ++) {
if (layerIndex >= 0) {
@ -285,9 +285,9 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
}
var upSkin = new D3D.Paths([], true);
if (layer + topSkinCount < slices.length) {
var downLayer = slices[layer + topSkinCount];
for (var i = 0; i < downLayer.length; i ++) {
upSkin.join(downLayer[i]);
var upLayer = slices[layer + topSkinCount];
for (var i = 0; i < upLayer.length; i ++) {
upSkin.join(upLayer[i]);
}
}
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 retractionAmount = printer.config["printer.retraction.amount"];
function sliceToGcode (slice) {
function sliceToGcode (path) {
var gcode = [];
for (var i = 0; i < slice.length; i ++) {
var shape = slice[i];
for (var i = 0; i < path.length; i ++) {
var shape = path[i];
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 ++) {
var point = shape[j % shape.length];
@ -408,13 +408,6 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
if (j === 0) {
//TODO
//add retraction
if (extruder > retractionMinDistance && retractionEnabled) {
gcode.push([
"G0",
"E" + (extruder - retractionAmount).toFixed(3),
"F" + (retractionSpeed * 60).toFixed(3)
].join(" "));
}
gcode.push([
"G0",
@ -422,13 +415,15 @@ D3D.Slicer.prototype.dataToGcode = function (data, printer) {
"F" + (travelSpeed * 60)
].join(" "));
if (extruder > retractionMinDistance && retractionEnabled) {
if (extruder > retractionMinDistance && retractionEnabled && j === 0) {
gcode.push([
"G0",
"E" + extruder.toFixed(3),
"F" + (retractionSpeed * 60).toFixed(3)
].join(" "));
}
}
else {
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;
}