changed format settings

This commit is contained in:
casperlamboo 2015-06-11 15:42:38 +02:00
parent 090bdf248a
commit 14c5d85318
7 changed files with 173 additions and 161 deletions

View File

@ -1,47 +1,50 @@
{ {
"ultimaker": { "ultimaker": {
"printer.baudrate": "115200", "baudrate": "115200",
"printer.dimensions.x": 200, "dimensionsX": 200,
"printer.dimensions.y": 200, "dimensionsY": 200,
"printer.dimensions.z": 200, "dimensionsZ": 200,
"printer.endcode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n", "endCode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n",
"printer.filamentThickness": 2.85, "filamentThickness": 2.85,
"printer.heatedbed": false, "heatedBed": false,
"printer.heatup.bed.temperature": 70, "heatupBedTemperature": 70,
"printer.heatup.enabled": true, "heatupEnabled": true,
"printer.heatup.temperature": 180, "heatupTemperature": 180,
"printer.nozzleDiameter": 0.4, "nozzleDiameter": 0.4,
"printer.startcode": ";Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG91 ;relative positioning\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG92 E0 ;zero the extruded length again\nG1 F9000\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n", "startCode": ";Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG91 ;relative positioning\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG92 E0 ;zero the extruded length again\nG1 F9000\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n",
"printer.type": "ultimaker" "temperature": 210.0,
"type": "ultimaker"
}, },
"ultimaker2": { "ultimaker2": {
"printer.baudrate": "115200", "baudrate": "115200",
"printer.dimensions.x": 223, "dimensionsX": 223,
"printer.dimensions.y": 223, "dimensionsY": 223,
"printer.dimensions.z": 205, "dimensionsZ": 205,
"printer.endcode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n", "endCode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n",
"printer.filamentThickness": 2.85, "filamentThickness": 2.85,
"printer.heatedbed": true, "heatedBed": true,
"printer.heatup.bed.temperature": 70, "heatupBedTemperature": 70,
"printer.heatup.enabled": true, "heatupEnabled": true,
"printer.heatup.temperature": 180, "heatupTemperature": 180,
"printer.nozzleDiameter": 0.4, "nozzleDiameter": 0.4,
"printer.startcode": ";Generated with Doodle3D (ultimaker2)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n", "startCode": ";Generated with Doodle3D (ultimaker2)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n",
"printer.type": "ultimaker2" "temperature": 210.0,
"type": "ultimaker2"
}, },
"ultimaker2go": { "ultimaker2go": {
"printer.baudrate": "115200", "baudrate": "115200",
"printer.dimensions.x": 120, "dimensionsX": 120,
"printer.dimensions.y": 120, "dimensionsY": 120,
"printer.dimensions.z": 115, "dimensionsZ": 115,
"printer.endcode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n", "endCode": "M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)\n",
"printer.filamentThickness": 2.85, "filamentThickness": 2.85,
"printer.heatedbed": false, "heatedBed": false,
"printer.heatup.bed.temperature": 70, "heatupBedTemperature": 70,
"printer.heatup.enabled": true, "heatupEnabled": true,
"printer.heatup.temperature": 20, "heatupTemperature": 20,
"printer.nozzleDiameter": 0.4, "nozzleDiameter": 0.4,
"printer.startcode": ";Generated with Doodle3D (ultimaker2)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n", "startCode": ";Generated with Doodle3D (ultimaker2)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n",
"printer.type": "ultimaker2g0" "temperature": 210.0,
"type": "ultimaker2g0"
} }
} }

View File

@ -1,25 +1,43 @@
{ {
"printer.normalFlowRate": 1.0, "layerHeight": 0.2,
"printer.bottomFlowRate": 2.0, "bottomThickness": 0.4,
"printer.bottomLayerSpeed": 35.0, "topThickness": 0.8,
"printer.bottomThickness": 0.4, "shellThickness": 0.4,
"printer.fillSize": 5.0, "brimOffset": 5.0,
"printer.firstLayerSlow": true, "fillGritSize": 5.0,
"printer.layerHeight": 0.2, "travelSpeed": 200.0,
"printer.retraction.amount": 3.0, "retractionAmount": 3.0,
"printer.retraction.enabled": true, "retractionEnabled": true,
"printer.retraction.speed": 50, "retractionSpeed": 50.0,
"printer.retraction.minDistance": 5.0, "retractionMinDistance": 5.0,
"printer.shellThickness": 0.4, "supportAccaptanceMargin": 1.5,
"printer.speed": 50.0, "supportDistanceY": 0.4,
"printer.brimOffset": 5.0, "supportUse": true,
"printer.temperature": 210.0, "supportGritSize": 6.0,
"printer.topThickness": 0.8, "supportMargin": 2.0,
"printer.travelSpeed": 200.0, "supportPlateSize": 4.0,
"printer.support.accaptanceMargin": 1.5, "outerLine": {
"printer.support.distanceY": 0.4, "flowRate": 1.0,
"printer.support.use": true, "speed": 50.0
"printer.support.gritSize": 6.0, },
"printer.support.margin": 2.0, "innerLine": {
"printer.support.plateSize": 4.0 "flowRate": 1.0,
"speed": 80.0
},
"fill": {
"flowRate": 1.0,
"speed": 80.0
},
"brim": {
"flowRate": 1.0,
"speed": 50.0
},
"support": {
"flowRate": 0.2,
"speed": 100.0
},
"bottom": {
"flowRate": 2.0,
"speed": 30.0
}
} }

View File

@ -37,7 +37,7 @@ function init () {
var printer = new D3D.Printer().updateConfig(USER_SETTINGS).updateConfig(PRINTER_SETTINGS["ultimaker"]); var printer = new D3D.Printer().updateConfig(USER_SETTINGS).updateConfig(PRINTER_SETTINGS["ultimaker"]);
var loader = new THREE.STLLoader(); var loader = new THREE.STLLoader();
loader.load('models/pokemon/pikachu.stl', function (geometry) { loader.load('models/support_test.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, 20, 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);

View File

@ -76,73 +76,70 @@ D3D.GCode.prototype.turnFanOff = function () {
return this; return this;
}; };
D3D.GCode.prototype.moveTo = function (extrude, x, y, layer) { D3D.GCode.prototype.moveTo = function (x, y, layer) {
"use strict"; "use strict";
var layerHeight = this.settings.config["printer.layerHeight"]; var layerHeight = this.settings.config["layerHeight"];
var firstLayerSlow = this.settings.config["printer.firstLayerSlow"]; var travelSpeed = this.settings.config["travelSpeed"];
var normalSpeed = this.settings.config["printer.speed"];
var bottomSpeed = this.settings.config["printer.bottomLayerSpeed"];
var normalSpeed = this.settings.config["printer.speed"];
var bottomSpeed = this.settings.config["printer.bottomLayerSpeed"];
var nozzleDiameter = this.settings.config["printer.nozzleDiameter"];
var filamentThickness = this.settings.config["printer.filamentThickness"];
var bottomFlowRate = this.settings.config["printer.bottomFlowRate"];
var normalFlowRate = this.settings.config["printer.normalFlowRate"];
var travelSpeed = this.settings.config["printer.travelSpeed"];
if (this.bottom) { var z = (layer + 1) * layerHeight;
var speed = bottomSpeed * 60; var speed = travelSpeed * 60;
var flowRate = bottomFlowRate;
} this.addGCode({
else { "G": 0,
var speed = normalSpeed * 60; "X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
var flowRate = normalFlowRate; "F": speed.toFixed(3)
} });
this.nozzlePosition.set(x, y);
return this;
};
D3D.GCode.prototype.lineTo = function (x, y, layer, type) {
"use strict";
var newNozzlePosition = new THREE.Vector2(x, y);
var layerHeight = this.settings.config["layerHeight"];
var nozzleDiameter = this.settings.config["nozzleDiameter"];
var filamentThickness = this.settings.config["filamentThickness"];
var travelSpeed = this.settings.config["travelSpeed"];
var profile = this.settings.config[(this.bottom ? "bottom" : type)];
var speed = profile["speed"] * 60;
var flowRate = profile["flowRate"];
var z = (layer + 1) * layerHeight; var z = (layer + 1) * layerHeight;
if (extrude) { var lineLength = this.nozzlePosition.distanceTo(newNozzlePosition);
var lineLength = this.nozzlePosition.distanceTo(new THREE.Vector2(x, y));
var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI; var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI;
this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate; this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate;
this.addGCode({ this.addGCode({
"G": 1, "G": 1,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3), "X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3), "F": speed.toFixed(3),
"E": this.extruder.toFixed(3) "E": this.extruder.toFixed(3)
}); });
}
else {
var speed = travelSpeed * 60;
this.addGCode({ this.nozzlePosition.copy(newNozzlePosition);
"G": 0,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3)
});
}
this.nozzlePosition = new THREE.Vector2(x, y);
return this; return this;
}; };
D3D.GCode.prototype.unRetract = function () { D3D.GCode.prototype.unRetract = function () {
"use strict"; "use strict";
if (this.isRetracted) { var retractionEnabled = this.settings.config["retractionEnabled"];
this.isRetracted = false; var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
var retractionAmount = this.settings.config["printer.retraction.amount"]; if (this.isRetracted && retractionEnabled) {
var retractionEnabled = this.settings.config["printer.retraction.enabled"]; this.isRetracted = false;
var retractionMinDistance = this.settings.config["printer.retraction.minDistance"];
var retractionSpeed = this.settings.config["printer.retraction.speed"];
var speed = retractionSpeed * 60; var speed = retractionSpeed * 60;
if (this.extruder > retractionMinDistance && retractionEnabled) { if (this.extruder > retractionMinDistance) {
this.addGCode({ this.addGCode({
"G": 0, "G": 0,
"E": this.extruder.toFixed(3), "E": this.extruder.toFixed(3),
@ -156,13 +153,13 @@ D3D.GCode.prototype.unRetract = function () {
D3D.GCode.prototype.retract = function () { D3D.GCode.prototype.retract = function () {
"use strict"; "use strict";
if (!this.isRetracted) { var retractionAmount = this.settings.config["retractionAmount"];
this.isRetracted = true; var retractionEnabled = this.settings.config["retractionEnabled"];
var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
var retractionAmount = this.settings.config["printer.retraction.amount"]; if (!this.isRetracted && retractionEnabled) {
var retractionEnabled = this.settings.config["printer.retraction.enabled"]; this.isRetracted = true;
var retractionMinDistance = this.settings.config["printer.retraction.minDistance"];
var retractionSpeed = this.settings.config["printer.retraction.speed"];
var speed = retractionSpeed * 60; var speed = retractionSpeed * 60;

View File

@ -14,9 +14,7 @@ D3D.Printer.prototype.updateConfig = function (config) {
"use strict"; "use strict";
for (var i in config) { for (var i in config) {
if (i.indexOf("printer") === 0) { this.config[i] = config[i];
this.config[i] = config[i];
}
} }
return this; return this;
@ -24,7 +22,7 @@ D3D.Printer.prototype.updateConfig = function (config) {
D3D.Printer.prototype.getStartCode = function () { D3D.Printer.prototype.getStartCode = function () {
"use strict"; "use strict";
var gcode = this.config["printer.startcode"]; var gcode = this.config["startCode"];
gcode = this.subsituteVariables(gcode); gcode = this.subsituteVariables(gcode);
return gcode; return gcode;
@ -32,7 +30,7 @@ D3D.Printer.prototype.getStartCode = function () {
D3D.Printer.prototype.getEndCode = function () { D3D.Printer.prototype.getEndCode = function () {
"use strict"; "use strict";
var gcode = this.config["printer.endcode"]; var gcode = this.config["endCode"];
gcode = this.subsituteVariables(gcode); gcode = this.subsituteVariables(gcode);
@ -41,12 +39,12 @@ D3D.Printer.prototype.getEndCode = function () {
D3D.Printer.prototype.subsituteVariables = function (gcode) { D3D.Printer.prototype.subsituteVariables = function (gcode) {
"use strict"; "use strict";
var temperature = this.config["printer.temperature"]; var temperature = this.config["temperature"];
var bedTemperature = this.config["printer.bed.temperature"]; var bedTemperature = this.config["bedTemperature"];
var preheatTemperature = this.config["printer.heatup.temperature"]; var preheatTemperature = this.config["heatupTemperature"];
var preheatBedTemperature = this.config["printer.heatup.bed.temperature"]; var preheatBedTemperature = this.config["heatupBedTemperature"];
var printerType = this.config["printer.type"]; var printerType = this.config["type"];
var heatedbed = this.config["printer.heatedbed"]; var heatedbed = this.config["heatedbed"];
switch (printerType) { switch (printerType) {
case "makerbot_replicator2": printerType = "r2"; break; case "makerbot_replicator2": printerType = "r2"; break;

View File

@ -150,7 +150,6 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
var y = layer * layerHeight; var y = layer * layerHeight;
var intersections = []; var intersections = [];
var log = [];
for (var i = 0; i < layerIntersections.length; i ++) { for (var i = 0; i < layerIntersections.length; i ++) {
var index = layerIntersections[i]; var index = layerIntersections[i];
var line = this.lines[index].line; var line = this.lines[index].line;
@ -166,7 +165,6 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
} }
intersections[index] = new THREE.Vector2(z, x); intersections[index] = new THREE.Vector2(z, x);
log.push({x: z, y: x, index: index, connects: this.lines[index].connects});
} }
var done = []; var done = [];
@ -194,8 +192,6 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
var faceNormal = faceNormals[Math.floor(j/2)]; var faceNormal = faceNormals[Math.floor(j/2)];
console.log();
if (a.distanceTo(b) === 0 || faceNormal.equals(new THREE.Vector2(0, 0))) { if (a.distanceTo(b) === 0 || faceNormal.equals(new THREE.Vector2(0, 0))) {
connects = connects.concat(this.lines[index].connects); connects = connects.concat(this.lines[index].connects);
faceNormals = faceNormals.concat(this.lines[index].normals); faceNormals = faceNormals.concat(this.lines[index].normals);
@ -280,20 +276,20 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
var scale = 100; var scale = 100;
var layerHeight = printer.config["printer.layerHeight"]; var layerHeight = printer.config["layerHeight"];
var nozzleDiameter = printer.config["printer.nozzleDiameter"] * scale; var nozzleDiameter = printer.config["nozzleDiameter"] * scale;
var shellThickness = printer.config["printer.shellThickness"] * scale; var shellThickness = printer.config["shellThickness"] * scale;
var fillSize = printer.config["printer.fillSize"] * scale; var fillGritSize = printer.config["fillGritSize"] * scale;
var brimOffset = printer.config["printer.brimOffset"] * scale; var brimOffset = printer.config["brimOffset"] * scale;
var bottomThickness = printer.config["printer.bottomThickness"]; var bottomThickness = printer.config["bottomThickness"];
var topThickness = printer.config["printer.topThickness"]; var topThickness = printer.config["topThickness"];
var useSupport = printer.config["printer.support.use"]; var useSupport = printer.config["supportUse"];
var supportGritSize = printer.config["printer.support.gritSize"] * scale; var supportGritSize = printer.config["supportGritSize"] * scale;
var supportAccaptanceMargin = printer.config["printer.support.accaptanceMargin"] * scale; var supportAccaptanceMargin = printer.config["supportAccaptanceMargin"] * scale;
var supportMargin = printer.config["printer.support.margin"] * scale; var supportMargin = printer.config["supportMargin"] * scale;
var plateSize = printer.config["printer.support.plateSize"] * scale; var plateSize = printer.config["supportPlateSize"] * scale;
var supportDistanceY = printer.config["printer.support.distanceY"]; var supportDistanceY = printer.config["supportDistanceY"];
var brimOffset = printer.config["printer.brimOffset"] * scale; var brimOffset = printer.config["brimOffset"] * scale;
var supportDistanceLayers = Math.ceil(supportDistanceY / layerHeight); var supportDistanceLayers = Math.ceil(supportDistanceY / layerHeight);
var bottomSkinCount = Math.ceil(bottomThickness/layerHeight); var bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
@ -305,7 +301,7 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
top: this.geometry.boundingBox.min.x * scale, top: this.geometry.boundingBox.min.x * scale,
right: this.geometry.boundingBox.max.z * scale, right: this.geometry.boundingBox.max.z * scale,
bottom: this.geometry.boundingBox.max.x * scale bottom: this.geometry.boundingBox.max.x * scale
}, fillSize, true, true); }, fillGritSize, true, true);
console.log("generating outer lines and inner lines"); console.log("generating outer lines and inner lines");
for (var layer = 0; layer < slices.length; layer ++) { for (var layer = 0; layer < slices.length; layer ++) {
@ -487,7 +483,7 @@ D3D.Slicer.prototype.dataToGCode = function (data, printer) {
var gcode = new D3D.GCode().setSettings(printer); var gcode = new D3D.GCode().setSettings(printer);
function sliceToGCode (path, retract, unRetract) { function sliceToGCode (path, retract, unRetract, type) {
for (var i = 0; i < path.length; i ++) { for (var i = 0; i < path.length; i ++) {
var shape = path[i]; var shape = path[i];
@ -497,14 +493,14 @@ D3D.Slicer.prototype.dataToGCode = function (data, printer) {
var point = shape[j % shape.length]; var point = shape[j % shape.length];
if (j === 0) { if (j === 0) {
gcode.moveTo(false, point.X, point.Y, layer); gcode.moveTo(point.X, point.Y, layer);
if (unRetract) { if (unRetract) {
gcode.unRetract(); gcode.unRetract();
} }
} }
else { else {
gcode.moveTo(true, point.X, point.Y, layer); gcode.lineTo(point.X, point.Y, layer, type);
} }
} }
} }
@ -523,22 +519,22 @@ D3D.Slicer.prototype.dataToGCode = function (data, printer) {
} }
if (slice.brim !== undefined) { if (slice.brim !== undefined) {
sliceToGCode(slice.brim, true, true); sliceToGCode(slice.brim, true, true, "brim");
} }
for (var i = 0; i < slice.parts.length; i ++) { for (var i = 0; i < slice.parts.length; i ++) {
var part = slice.parts[i]; var part = slice.parts[i];
sliceToGCode(part.outerLine, false, true); sliceToGCode(part.outerLine, false, true, "outerLine");
for (var j = 0; j < part.innerLines.length; j ++) { for (var j = 0; j < part.innerLines.length; j ++) {
var innerLine = part.innerLines[j]; var innerLine = part.innerLines[j];
sliceToGCode(innerLine, false, false); sliceToGCode(innerLine, false, false, "innerLine");
} }
sliceToGCode(part.fill, true, false); sliceToGCode(part.fill, true, false, "fill");
} }
if (slice.support !== undefined) { if (slice.support !== undefined) {
sliceToGCode(slice.support, true, true); sliceToGCode(slice.support, true, true, "support");
} }
this.progress.gcodeLayer = layer; this.progress.gcodeLayer = layer;
@ -550,8 +546,8 @@ D3D.Slicer.prototype.dataToGCode = function (data, printer) {
D3D.Slicer.prototype.getGCode = function (printer) { D3D.Slicer.prototype.getGCode = function (printer) {
"use strict"; "use strict";
var layerHeight = printer.config["printer.layerHeight"]; var layerHeight = printer.config["layerHeight"];
var dimensionsZ = printer.config["printer.dimensions.z"]; var dimensionsZ = printer.config["dimensionsZ"];
this.progress.totalLayers = Math.floor(Math.min(this.geometry.boundingBox.max.y, dimensionsZ) / layerHeight); this.progress.totalLayers = Math.floor(Math.min(this.geometry.boundingBox.max.y, dimensionsZ) / layerHeight);
this.progress.sliceLayer = 0; this.progress.sliceLayer = 0;

View File

@ -91,7 +91,7 @@ function init () {
}; };
var loader = new THREE.STLLoader(); var loader = new THREE.STLLoader();
loader.load('models/pokemon/pikachu.stl', function (geometry) { loader.load('models/support_test.stl', function (geometry) {
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone(); //var geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false}); var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false});
@ -99,7 +99,7 @@ function init () {
var mesh = new THREE.Mesh(geometry, material); var mesh = new THREE.Mesh(geometry, material);
mesh.rotation.x = -Math.PI/2; mesh.rotation.x = -Math.PI/2;
mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.5; mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
mesh.position.y = -0.1; mesh.position.y = -0.1;
mesh.position.x = 60; mesh.position.x = 60;
mesh.position.z = 60; mesh.position.z = 60;