cleaner structure

This commit is contained in:
casperlamboo 2015-04-24 21:32:39 +02:00
parent 921708331d
commit ab9167e446
21 changed files with 43 additions and 25 deletions

BIN
.DS_Store vendored

Binary file not shown.

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
.DS_Store
.DS_Store
src/.DS_Store
src/.DS_Store
src/library/.DS_Store
.DS_Store
src/script/.DS_Store
src/.DS_Store

View File

@ -7,10 +7,10 @@
<script src="library/cal.js"></script> <script src="library/cal.js"></script>
<script src="library/three.js"></script> <script src="library/three.js"></script>
<script src="script/utils.js"></script> <script src="src/utils.js"></script>
<script src="script/box.js"></script> <script src="src/box.js"></script>
<script src="script/printer.js"></script> <script src="src/printer.js"></script>
<script src="script/slicer.js"></script> <script src="src/slicer.js"></script>
<script src="gcode/testgcode.js"></script> <script src="gcode/testgcode.js"></script>
<script src="gcode/easterbunny.js"></script> <script src="gcode/easterbunny.js"></script>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -3,9 +3,9 @@
<head> <head>
<title>Doedel Drie Dee</title> <title>Doedel Drie Dee</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="script/utils.js"></script> <script src="src/utils.js"></script>
<script src="script/box.js"></script> <script src="src/box.js"></script>
<script src="script/printer.js"></script> <script src="src/printer.js"></script>
</head> </head>
<body> <body>

View File

@ -6,10 +6,10 @@
<script src="library/jquery.js"></script> <script src="library/jquery.js"></script>
<script src="library/three.js"></script> <script src="library/three.js"></script>
<script src="script/utils.js"></script> <script src="src/utils.js"></script>
<script src="script/box.js"></script> <script src="src/box.js"></script>
<script src="script/printer.js"></script> <script src="src/printer.js"></script>
<script src="script/slicer.js"></script> <script src="src/slicer.js"></script>
<script src="gcode/testgcode.js"></script> <script src="gcode/testgcode.js"></script>
<script src="gcode/easterbunny.js"></script> <script src="gcode/easterbunny.js"></script>
@ -55,9 +55,10 @@ scene.add(mesh);
var slicer = new D3D.Slicer(geometry); var slicer = new D3D.Slicer(geometry);
/*var slices = slicer.slice(20, 0.2); var slices = slicer.slice(200, 0.2);
//document.write(JSON.stringify(slices));
var canvas = document.getElementById("canvas"); /*var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d"); var context = canvas.getContext("2d");
for (var layer = 0; layer < slices.length; layer ++) { for (var layer = 0; layer < slices.length; layer ++) {

BIN
src/.DS_Store vendored

Binary file not shown.

BIN
src/library/.DS_Store vendored

Binary file not shown.

View File

@ -9,7 +9,9 @@ D3D.Printer = function (config) {
"use strict"; "use strict";
for (var i in config) { for (var i in config) {
this[i] = config[i]; if (i.indexOf("printer") === 0) {
this[i] = config[i];
}
} }
}; };
D3D.Printer.prototype.getStartCode = function () { D3D.Printer.prototype.getStartCode = function () {

BIN
src/script/.DS_Store vendored

Binary file not shown.

View File

@ -142,23 +142,22 @@ D3D.Slicer.prototype.getGcode = function (printer) {
var travelSpeed = doodleBox.printer["printer.travelSpeed"]; var travelSpeed = doodleBox.printer["printer.travelSpeed"];
var filamentThickness = doodleBox.printer["printer.filamentThickness"]; var filamentThickness = doodleBox.printer["printer.filamentThickness"];
var wallThickness = doodleBox.printer["printer.wallThickness"]; var wallThickness = doodleBox.printer["printer.wallThickness"];
var screenToMillimeterScale = doodleBox.printer["printer.screenToMillimeterScale"];
var layerHeight = doodleBox.printer["printer.layerHeight"]; var layerHeight = doodleBox.printer["printer.layerHeight"];
var useSubLayers = doodleBox.printer["printer.useSubLayers"];
var enableTraveling = doodleBox.printer["printer.enableTraveling"]; var enableTraveling = doodleBox.printer["printer.enableTraveling"];
var retractionEnabled = doodleBox.printer["printer.retraction.enabled"]; var retractionEnabled = doodleBox.printer["printer.retraction.enabled"];
var retractionspeed = doodleBox.printer["printer.retraction.speed"]; var retractionSpeed = doodleBox.printer["printer.retraction.speed"];
var retractionminDistance = doodleBox.printer["printer.retraction.minDistance"]; var retractionminDistance = doodleBox.printer["printer.retraction.minDistance"];
var retractionamount = doodleBox.printer["printer.retraction.amount"]; var retractionAmount = doodleBox.printer["printer.retraction.amount"];
var dimensionsZ = doodleBox.printer["printer.dimensions.z"];
var gcode = doodleBox.printer.getStartCode(); var gcode = doodleBox.printer.getStartCode();
var extruder = 0.0; var extruder = 0.0;
var speed = (bottomSpeed*60).toFixed(3); var speed = firstLayerSlow ? (bottomSpeed*60).toFixed(3) : (normalSpeed*60).toFixed(3);
var flowRate = bottomFlowRate; var flowRate = bottomFlowRate;
var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI; var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI;
var slices = this.slice(200, layerHeight); var slices = this.slice(dimensionsZ, layerHeight);
for (var layer = 0; layer < slices.length; layer ++) { for (var layer = 0; layer < slices.length; layer ++) {
var slice = slices[layer]; var slice = slices[layer];
@ -184,11 +183,11 @@ D3D.Slicer.prototype.getGcode = function (printer) {
if (j === 0) { if (j === 0) {
//TODO //TODO
//add retraction //add retraction
if (extruder > retractionamount && retractionEnabled) { if (extruder > retractionAmount && retractionEnabled) {
gcode.push([ gcode.push([
"G0", "G0",
"E" + (extruder - retractionamount).toFixed(3), "E" + (extruder - retractionAmount).toFixed(3),
"F" + (retractionspeed * 60).toFixed(3) "F" + (retractionSpeed * 60).toFixed(3)
].join(" ")); ].join(" "));
} }
@ -198,11 +197,11 @@ D3D.Slicer.prototype.getGcode = function (printer) {
"F" + (travelSpeed*60) "F" + (travelSpeed*60)
].join(" ")); ].join(" "));
if (extruder > retractionamount && retractionEnabled) { if (extruder > retractionAmount && retractionEnabled) {
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(" "));
} }
} }