diff --git a/css/fixedPosInterface.css b/css/fixedPosInterface.css index 56af0cd..eb071f2 100644 --- a/css/fixedPosInterface.css +++ b/css/fixedPosInterface.css @@ -17,6 +17,37 @@ body { /*}*/ +#verticalShapes { + position:absolute; + right: -56px; + bottom: 15px; + /*background-color: #fff;*/ +} + +.verticalshape { + width: 50px; + height: 50px; + border: 2px solid #333; + border-radius: 0px 5px 5px 0px; + margin-top: 4px; + /*background-color: #f0f;*/ + cursor: pointer; +} + +.straight { + background: url('../img/vertical_shape_icons/straight.png') no-repeat; +} +.diverging { + background: url('../img/vertical_shape_icons/diverging.png') no-repeat; +} +.converging { + background: url('../img/vertical_shape_icons/converging.png') no-repeat; +} +.sinus { + background: url('../img/vertical_shape_icons/sinus.png') no-repeat; +} + + /* Portrait */ @media screen and (orientation:portrait) { body { @@ -186,8 +217,8 @@ body { /* THERMOMETER */ #thermometerContainer { position: absolute; - right: 25px; - top: 370px; + right: 5px; + top: 360px; } #thermometerCanvas { /*background: #59b2b8;*/ diff --git a/img/logo_smaller.png b/img/logo_smaller.png index 17f2799..f000e5c 100644 Binary files a/img/logo_smaller.png and b/img/logo_smaller.png differ diff --git a/img/vertical_shape_icons/converging.png b/img/vertical_shape_icons/converging.png index 1e84963..f243974 100644 Binary files a/img/vertical_shape_icons/converging.png and b/img/vertical_shape_icons/converging.png differ diff --git a/img/vertical_shape_icons/diverging.png b/img/vertical_shape_icons/diverging.png index 412de97..db0969e 100644 Binary files a/img/vertical_shape_icons/diverging.png and b/img/vertical_shape_icons/diverging.png differ diff --git a/img/vertical_shape_icons/sinus.png b/img/vertical_shape_icons/sinus.png index 742a777..a0524f7 100644 Binary files a/img/vertical_shape_icons/sinus.png and b/img/vertical_shape_icons/sinus.png differ diff --git a/img/vertical_shape_icons/straight.png b/img/vertical_shape_icons/straight.png new file mode 100644 index 0000000..f9df8f8 Binary files /dev/null and b/img/vertical_shape_icons/straight.png differ diff --git a/index.html b/index.html index b2a0ce2..9a9d1c5 100755 --- a/index.html +++ b/index.html @@ -68,6 +68,12 @@
+
+
+
+
+
+
@@ -92,6 +98,7 @@ + diff --git a/js/canvasDrawing_v01.js b/js/canvasDrawing_v01.js index f6bd21a..4c7f48d 100644 --- a/js/canvasDrawing_v01.js +++ b/js/canvasDrawing_v01.js @@ -147,6 +147,7 @@ function clearDoodle() { clearMainView(); resetPreview(); + resetVerticalShapes(); } function redrawDoodle() { diff --git a/js/gcodeGenerating_v01.js b/js/gcodeGenerating_v01.js index 9e055ca..7f9c45c 100755 --- a/js/gcodeGenerating_v01.js +++ b/js/gcodeGenerating_v01.js @@ -9,7 +9,7 @@ gcodeStart.push("G1 Z15 F9000"); // move the platform down 15mm gcodeStart.push("G92 E0"); // zero the extruded length gcodeStart.push("G1 F200 E10"); // extrude 10mm of feed stock gcodeStart.push("G92 E0"); // zero the extruded length again -gcodeStart.push("G92 X-100 Y-100 E0"); // zero the extruded length again and make center the start position +//gcodeStart.push("G92 X-100 Y-100 E0"); // zero the extruded length again and make center the start position gcodeStart.push("G1 F9000"); gcodeStart.push("G90"); // absolute positioning gcodeStart.push("M117 Printing Doodle... "); // display message (20 characters to clear whole screen) @@ -43,16 +43,22 @@ function generate_gcode(callback) { startGcode = $("#startgcode").val().trim().split("\n"); } else { console.log(" no start-gcode in settings.html, using defaults") - startGcode.concat(gcodeStart); + startGcode = startGcode.concat(gcodeStart); } + console.log("f:generate_gcode() >> startGcode:"); + console.log(startGcode); + console.log(""); + console.log("f:generate_gcode() >> endGcode:"); + console.log(endGcode); + // get gcode end statements if ($("#endgcode").val().trim().length != 0) { console.log(" found contents for end-gcode in settings.html") endGcode = $("#endgcode").val().trim().split("\n"); } else { console.log(" no end-gcode in settings.html, using defaults") - endGcode.concat(gcodeEnd); + endGcode = endGcode.concat(gcodeEnd); } gcode = []; @@ -148,7 +154,8 @@ function generate_gcode(callback) { var progress = layer / layers; // float layerScale = scaleFunction(float(layer)/layers); // scaleFactor van de layer -> lookup naar vfunc[] voor die scaleVals - var layerScale = 1.0; +// var layerScale = 1.0; + var layerScale = scaleFunction(progress); // if begin point this row and end point last row are close enough, isLoop is true var isLoop = lineLength(points[0][0], points[0][1], points[points.length-1][0], points[points.length-1][1]) < 3; @@ -264,8 +271,24 @@ function generate_gcode(callback) { } function scaleFunction(percent) { - var r; + var r = 1.0; + switch (VERTICALSHAPE) { + case verticalShapes.NONE: + r = 1.0; + break; + case verticalShapes.DIVERGING: + r = .5 + (percent * .5); + break; + case verticalShapes.CONVERGING: + r = 1.0 - (percent * .8); + break; + case verticalShapes.SINUS: + r = (Math.cos(percent * Math.PI * 4) * .25) + .75; + break; + } + +// return 1.0 - (percent *.8); return r; } diff --git a/js/main.js b/js/main.js index ce40827..f7c0973 100644 --- a/js/main.js +++ b/js/main.js @@ -8,7 +8,8 @@ var printer = new Printer(); var thermometer = new Thermometer(); var settingsWindow = new SettingsWindow(); -var firstTimesettingsLoaded = true; +var firstTimesettingsLoaded = true; + $(function() { console.log("ready"); @@ -38,6 +39,7 @@ $(function() { initDoodleDrawing(); initPreviewRendering(); initButtonBehavior(); + initVerticalShapes(); thermometer.init($("#thermometerCanvas"), $("#thermometerContainer")); @@ -47,7 +49,7 @@ $(function() { settingsWindow.init(wifiboxURL); $(document).on(SettingsWindow.SETTINGS_LOADED,settingsLoaded); - if(debugMode) { + if(debugMode) { console.log("debug mode is true"); $("body").css("overflow", "auto"); $("#debug_textArea").css("display", "block"); diff --git a/js/previewRendering_v02.js b/js/previewRendering_v02.js index 3cd074a..957e7b1 100644 --- a/js/previewRendering_v02.js +++ b/js/previewRendering_v02.js @@ -103,6 +103,7 @@ function redrawPreview(redrawLess) { for(var i = 0; i < numLayers; i++) { + var verticalScaleFactor = scaleFunction(i / maxNumLayers); if(i == 0 || i == Math.floor(numLayers/2) || i == numLayers-1) { previewCtx.globalAlpha = 1; @@ -120,7 +121,7 @@ function redrawPreview(redrawLess) { previewCtx.translate(layerCX, layerOffsetY + layerCY + y); // previewCtx.setTransform(1, 0, 0, scaleY, layerCX, layerOffsetY+layerCY+y); - previewCtx.scale(viewerScale, scaleY * viewerScale); + previewCtx.scale(viewerScale * verticalScaleFactor, scaleY * viewerScale * verticalScaleFactor); previewCtx.rotate(r); previewCtx.translate((-doodleTransform[0]) * (globalScale * doodleTransform[2]), (-doodleTransform[1]) * (globalScale * doodleTransform[3])); @@ -185,6 +186,8 @@ function renderToImageDataPreview() { for(var i=0;i