mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2025-01-22 09:05:12 +01:00
added top & bottom thickness
This commit is contained in:
parent
f38ab10e62
commit
ec447ab56e
BIN
models/stanford_bunny_high.stl
Normal file
BIN
models/stanford_bunny_high.stl
Normal file
Binary file not shown.
@ -48,27 +48,29 @@ var printerConfig = {
|
|||||||
"printer.retraction.minDistance": 5,
|
"printer.retraction.minDistance": 5,
|
||||||
"printer.retraction.speed": 50,
|
"printer.retraction.speed": 50,
|
||||||
"printer.screenToMillimeterScale": 0.3, //????
|
"printer.screenToMillimeterScale": 0.3, //????
|
||||||
"printer.speed": 70,
|
|
||||||
"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)",
|
"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)",
|
||||||
"printer.temperature": 230,
|
"printer.temperature": 230,
|
||||||
"printer.travelSpeed": 200,
|
"printer.travelSpeed": 200,
|
||||||
"printer.type": "ultimaker",
|
"printer.type": "ultimaker",
|
||||||
"printer.useSubLayers": true, //wat is dit?
|
"printer.useSubLayers": true, //wat is dit?
|
||||||
|
|
||||||
|
"printer.speed": 50,
|
||||||
"printer.wallThickness": 0.4, //nozzle
|
"printer.wallThickness": 0.4, //nozzle
|
||||||
"printer.layerHeight": 0.2,
|
"printer.layerHeight": 0.2,
|
||||||
|
|
||||||
|
|
||||||
//variabele toevoegen;
|
//variabele toevoegen;
|
||||||
//-snelheid, retraction etc voor verschillende types (outerlayer, innerlayer, fill)
|
//-snelheid, retraction etc voor verschillende types (outerlayer, innerlayer, fill)
|
||||||
|
"printer.bottomThickness": 0.4,
|
||||||
|
"printer.topThickness": 0.8,
|
||||||
"printer.shellThickness": 0.4,
|
"printer.shellThickness": 0.4,
|
||||||
"printer.fillSize": 5, //dit is het raster aan de binnen kant van de geometry
|
"printer.fillSize": 5, //dit is het raster aan de binnen kant van de geometry
|
||||||
"printer.brimOffset": 5,
|
"printer.brimOffset": 5
|
||||||
"printer.bottomTopThickness": 0.8
|
|
||||||
};
|
};
|
||||||
var printer = new D3D.Printer(printerConfig);
|
var printer = new D3D.Printer(printerConfig);
|
||||||
|
|
||||||
var localIp = location.hash.substring(1);
|
var localIp = location.hash.substring(1);
|
||||||
//var doodleBox = new D3D.Box(localIp);
|
var doodleBox = new D3D.Box(localIp);
|
||||||
//var printer = doodleBox.printer;
|
//var printer = doodleBox.printer;
|
||||||
|
|
||||||
var scene = new THREE.Scene();
|
var scene = new THREE.Scene();
|
||||||
@ -88,7 +90,7 @@ camera.add(directionalLight);
|
|||||||
applyMouseControls(renderer, camera, new THREE.Vector3(100, 0, 100), 1000);
|
applyMouseControls(renderer, camera, new THREE.Vector3(100, 0, 100), 1000);
|
||||||
|
|
||||||
var loader = new THREE.STLLoader();
|
var loader = new THREE.STLLoader();
|
||||||
loader.load("models/pikachu.stl", function (geometry) {
|
loader.load("models/d20.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, 10, 10);
|
||||||
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
//var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
||||||
@ -122,6 +124,7 @@ loader.load("models/pikachu.stl", function (geometry) {
|
|||||||
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.rotation.z = Math.PI;
|
||||||
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;
|
||||||
@ -134,7 +137,7 @@ loader.load("models/pikachu.stl", function (geometry) {
|
|||||||
var canvas = document.getElementById("canvas");
|
var canvas = document.getElementById("canvas");
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext("2d");
|
||||||
|
|
||||||
var img = slicer.drawPaths(printer, 5, 6);
|
var img = slicer.drawPaths(printer, 0, 1);
|
||||||
context.drawImage(img, 0, 0);
|
context.drawImage(img, 0, 0);
|
||||||
|
|
||||||
gcode = slicer.getGcode(printer);
|
gcode = slicer.getGcode(printer);
|
||||||
|
@ -252,7 +252,11 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
|||||||
var shellThickness = printer.config["printer.shellThickness"] * scale;
|
var shellThickness = printer.config["printer.shellThickness"] * scale;
|
||||||
var fillSize = printer.config["printer.fillSize"] * scale;
|
var fillSize = printer.config["printer.fillSize"] * scale;
|
||||||
var brimOffset = printer.config["printer.brimOffset"] * scale;
|
var brimOffset = printer.config["printer.brimOffset"] * scale;
|
||||||
var skinCount = Math.ceil(shellThickness/layerHeight);
|
var bottomThickness = printer.config["printer.bottomThickness"] * scale;
|
||||||
|
var topThickness = printer.config["printer.topThickness"] * scale;
|
||||||
|
|
||||||
|
var bottomSkinCount = Math.ceil(bottomThickness/layerHeight);
|
||||||
|
var topSkinCount = Math.ceil(topThickness/layerHeight);
|
||||||
|
|
||||||
var start = new THREE.Vector2(0, 0);
|
var start = new THREE.Vector2(0, 0);
|
||||||
|
|
||||||
@ -272,15 +276,15 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
|||||||
data.push(layerData);
|
data.push(layerData);
|
||||||
|
|
||||||
var downSkin = new D3D.Paths([], true);
|
var downSkin = new D3D.Paths([], true);
|
||||||
if (layer - skinCount >= 0) {
|
if (layer - bottomSkinCount >= 0) {
|
||||||
var downLayer = slices[layer - skinCount];
|
var downLayer = slices[layer - bottomSkinCount];
|
||||||
for (var i = 0; i < downLayer.length; i ++) {
|
for (var i = 0; i < downLayer.length; i ++) {
|
||||||
downSkin.join(downLayer[i]);
|
downSkin.join(downLayer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var upSkin = new D3D.Paths([], true);
|
var upSkin = new D3D.Paths([], true);
|
||||||
if (layer + skinCount < slices.length) {
|
if (layer + topSkinCount < slices.length) {
|
||||||
var downLayer = slices[layer + skinCount];
|
var downLayer = slices[layer + topSkinCount];
|
||||||
for (var i = 0; i < downLayer.length; i ++) {
|
for (var i = 0; i < downLayer.length; i ++) {
|
||||||
upSkin.join(downLayer[i]);
|
upSkin.join(downLayer[i]);
|
||||||
}
|
}
|
||||||
@ -291,9 +295,10 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
|||||||
for (var i = 0; i < slice.length; i ++) {
|
for (var i = 0; i < slice.length; i ++) {
|
||||||
var part = slice[i];
|
var part = slice[i];
|
||||||
|
|
||||||
var outerLayer = part.clone();
|
//var outerLayer = part.clone();
|
||||||
outerLayer.scaleUp(scale);
|
var outerLayer = part.clone().scaleUp(scale).offset(-wallThickness/2);
|
||||||
|
|
||||||
|
if (outerLayer.length > 0) {
|
||||||
var insets = new D3D.Paths([], true);
|
var insets = new D3D.Paths([], true);
|
||||||
for (var offset = wallThickness; offset <= shellThickness; offset += wallThickness) {
|
for (var offset = wallThickness; offset <= shellThickness; offset += wallThickness) {
|
||||||
var inset = outerLayer.offset(-offset);
|
var inset = outerLayer.offset(-offset);
|
||||||
@ -347,6 +352,7 @@ D3D.Slicer.prototype.slicesToData = function (slices, printer) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user