From 80ec6f0f18fd6ac81f9473c2bbfe681fbb8cd2be Mon Sep 17 00:00:00 2001 From: lawgicau Date: Tue, 6 Jul 2021 20:23:34 +1000 Subject: [PATCH] Multi nozzle/layer pt 1 Baseline and first layer working. Retraction code testing, new STL needed. --- calibration.html | 75 +- files/flatsquare.stl | Bin 0 -> 684 bytes js/baseline.js | 10272 +++++++++++++++++++++------------------- js/commongcode.js | 21 + js/firstlayer.js | 52 +- js/gcodeprocessing.js | 165 +- js/loadscripts.js | 1 + js/retraction.js | 20 +- troubleshooting.html | 2 +- 9 files changed, 5533 insertions(+), 5075 deletions(-) create mode 100644 files/flatsquare.stl create mode 100644 js/commongcode.js diff --git a/calibration.html b/calibration.html index ee39901..c66cb0d 100644 --- a/calibration.html +++ b/calibration.html @@ -152,9 +152,17 @@

Another advantage of some ABL systems is that once the Z offset is set, you can interchange build surfaces of various thicknesses, with no changes needed for a successful first layer. Assuming the probe is triggered the same way on the bed surface, the Z offset is applied to this trigger point and the first layer height should be the same. On a manually levelled bed, the four corner knobs would need to be turned in unison to raise or lower the bed in accounting for thickness of the new build surface.

First layer gcode generator

The following form will create a series of five squares that you can use to live level your bed or set the Z offset. It is quick to print and features one square in the middle of the bed, with four others in the corners. You can use these to turn the levelling knobs in each corner until they are consistent, or ensure your ABL system is working if you have one in place.

-

This test uses a 0.2mm first layer height.

+

Nozzle Diameter / Layer Height

+

Select your nozzle diameter and layer height. If you have not changed your nozzle, it will likely be 0.4 mm. 0.2 mm is a typical layer height for this nozzle.

+ +

Additional start gcode

If you have additional start commands, tick the box and enter the gcode. This can be used for an extruder prime sequence, overwriting the standard flow rate, compensating for 2.85/3.00 mm filament, setting K factor and more. Tick the box for more details.

@@ -212,9 +220,10 @@

Retraction

If you don't know what to enter here, you can leave the retraction speed at 40 mm/sec. For a bowden tube printer, 6mm is a likely retraction distance. For direct drive, a starting value of 1mm may be suitable. If you are not sure about extra restart distance, leave this as 0.

- - - +

+

+

+

@@ -238,6 +247,15 @@

The form below will create a customised version of the XYZ 20mm calibration cube by iDig3Dprinting. It is fast to print and gives a good indication if there is any fundamental problem with the printer.

+

Nozzle Diameter / Layer Height

+

Select your nozzle diameter and layer height. If you have not changed your nozzle, it will likely be 0.4 mm. 0.2 mm is a typical layer height for this nozzle. First layer height will be locked to the overall layer height. There are too many permutations to include support for first layer height variation too.

+ +

Additional start gcode

If you have additional start commands, tick the box and enter the gcode. This can be used for an extruder prime sequence, overwriting the standard flow rate, compensating for 2.85/3.00 mm filament, setting K factor and more. Tick the box for more details.

@@ -270,16 +288,12 @@

Part Cooling Fan

-

Printing with PLA typically has the part cooling fan come on from layer 2. Alter this default behaviour here:

- - % +

Auto Bed Levelling

@@ -293,10 +307,10 @@

Retraction

If you don't know what to enter here, you can leave the retraction speed at 40 mm/sec. For a bowden tube printer, 6mm is a likely retraction distance. For direct drive, a starting value of 1mm may be suitable. If you are not sure about extra restart distance, leave this as 0.

- - - - +

+

+

+

@@ -685,6 +699,15 @@

The following form will create a retraction tower to conveniently test back to back parameters in the same print. Of the three available parameters, it is best to change only one per test print. For example, keep the retraction speed and extra restart distance the same, but vary the retraction distance over each segment. Changing more than one parameter makes is hard to tell what made the difference. The print is quick, so repeat the test varying other parameters until you are happy with them all.

Here is the STL if you would like to slice a similar test yourself: retractiontest.stl

+

Nozzle Diameter / Layer Height

+

Select your nozzle diameter and layer height. If you have not changed your nozzle, it will likely be 0.4 mm. 0.2 mm is a typical layer height for this nozzle. First layer height will be locked to the overall layer height. There are too many permutations to include support for first layer height variation too.

+ +

Additional start gcode

If you have additional start commands, tick the box and enter the gcode. This can be used for an extruder prime sequence, overwriting the standard flow rate, compensating for 2.85/3.00 mm filament, setting K factor and more. Tick the box for more details.

@@ -717,16 +740,12 @@

Part Cooling Fan

-

PLA typically has the part cooling fan come on from layer 2. Alter this default behaviour here:

- - % +

Auto Bed Levelling

diff --git a/files/flatsquare.stl b/files/flatsquare.stl new file mode 100644 index 0000000000000000000000000000000000000000..b709c5bbdff5b583e7026f375cdb905925a8069b GIT binary patch literal 684 zcmb7?K?=e!5JhtU*RFE_Em&P!5Iuo6C@K^bi?}emT%)JSAv}=!TE0waT{w`=OyBvsrr(%cx;}x5 zifF~6$z$S+v8x`6wXc)Ne-l#SSxgHdi-oO>-D5~-b}G -1){ - var value = parseFloat(firstlayerArray[item].match(regexp)[0].substring(1)) + offsets[i*2]; - firstlayerArray[item] = firstlayerArray[item].replace(regexp, "X"+String(value)); - } - }); - var regexp = /Y[0-9\.]+/; - firstlayerArray.forEach(function(index, item){ - if(firstlayerArray[item].search(/Y/) > -1){ - var value = parseFloat(firstlayerArray[item].match(regexp)[0].substring(1)) + offsets[i*2+1]; - firstlayerArray[item] = firstlayerArray[item].replace(regexp, "Y"+String(value)) - } - }); - skirt = firstlayerArray.join("\n"); - skirts += skirt; var square = "; square "+(i+1)+"\n"+originalSquare; var firstlayerArray = square.split(/\n/g); var regexp = /X[0-9\.]+/; @@ -223,9 +205,14 @@ function processFirstlayer(){ square = firstlayerArray.join("\n"); squares += square; } - var firstlayer = firstlayerStart+skirts+squares+firstlayerEnd; - firstlayer = firstlayer.replace(/G1 E-5.0000 F2400/g, "G1 E-"+retDist+" F"+retSpeed+" ; custom retraction"); - firstlayer = firstlayer.replace(/G1 E0.0000 F2400/g, "G1 E"+retDistExtra+" F"+retSpeed+" ; custom un-retraction/prime"); + var firstlayer = firstlayerStart+squares+commonEnd; + firstlayer = firstlayer.replace(/;retract1\nG1 Z[0-9\.]+ F1200/g, ";retract1\n;zhop1"); + if(zhop > 0){ + firstlayer = firstlayer.replace(/;zhop1/g, "G91;\nG1 Z"+zhop+" F1200; custom z hop\nG90;"); + } + firstlayer = firstlayer.replace(/;retract1/g, "G1 E-"+retDist+" F"+retSpeed+" ; custom retraction"); + firstlayer = firstlayer.replace(/;unretract1/g, "G1 E"+retDistExtra+" F"+retSpeed+" ; custom un-retraction/prime"); + if(document.firstlayerForm.psuon.checked == true) { firstlayer = firstlayer.replace(/;M80/, "M80"); } @@ -239,6 +226,7 @@ function processFirstlayer(){ } function processBaseline(){ + var nozzleLayer = document.baselineForm.nozzleLayer.value; var hotendTemp = document.baselineForm.hotendtemp.value; var bedTemp = document.baselineForm.bedtemp.value; var centre = document.baselineForm.centre.checked; @@ -247,38 +235,35 @@ function processBaseline(){ var retDist = document.baselineForm.retdist.value; var retDistExtra = document.baselineForm.retdistextra.value; var retSpeed = document.baselineForm.retspeed.value*60; + var zhop = document.baselineForm.zhop.value; var abl = document.baselineForm.abl.value; - var pc = document.baselineForm.pc.value; - var pcResume = 255; + var fanLayer = document.baselineForm.fanLayer.value; + var fanPercentage = document.baselineForm.fanSpeed.value; + var fanSpeed = Math.round(fanPercentage*2.55); var customStart = document.baselineForm.startgcode.value; - var baseline = originalBaseline; - switch(pc){ - case '0': - baseline = baseline.replace(/;fan2/, "M106 S255 ; custom fan 100% from layer 2"); + var baseline = commonStart; + switch(nozzleLayer){ + case '40_20': + baseline += baseline_40_20; break; - case '1': - baseline = baseline.replace(/;fan3/, "M106 S255 ; custom fan 100% from layer 3"); - break; - case '2': - baseline = baseline.replace(/;fan5/, "M106 S255 ; custom fan 100% from layer 5"); - break; - case '3': - baseline = baseline.replace(/;fan2/, "M106 S130 ; custom fan 50% from layer 2"); - pcResume = 130; - break; - case '4': - baseline = baseline.replace(/;fan3/, "M106 S130 ; custom fan 50% from layer 3"); - pcResume = 130; - break; - case '5': - baseline = baseline.replace(/;fan5/, "M106 S130 ; custom fan 50% from layer 5"); - pcResume = 130; - break; - case '6': - baseline = baseline.replace(/;fan2/, "; custom fan off"); - pcResume = 0; + case '40_16': + baseline += baseline_40_16; break; } + baseline += commonEnd; + baseline = baseline.replace(/M106 S3/, ";"); + switch(fanLayer){ + case '2': + baseline = baseline.replace(/;fan2;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 2"); + break; + case '3': + baseline = baseline.replace(/;fan3;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 3"); + break; + case '5': + baseline = baseline.replace(/;fan5;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 5"); + break; + } + baseline = baseline.replace(/M106 S3/g, "M106 S"+fanSpeed+"; custom fan "+fanSpeed+"%"); baseline = baseline.replace(/M140 S60/g, "M140 S"+bedTemp+" ; custom bed temp"); baseline = baseline.replace(/M190 S60/g, "M190 S"+bedTemp+" ; custom bed temp"); if(abl != 4){ @@ -288,8 +273,12 @@ function processBaseline(){ baseline = baseline.replace(/M104 S210 T0/g, "; Prusa Mini"); baseline = baseline.replace(/M109 S210 T0/g, "; Prusa Mini"); } - baseline = baseline.replace(/G1 E-5.0000 F2400/g, "G1 E-"+retDist+" F"+retSpeed+" ; custom retraction"); - baseline = baseline.replace(/G1 E0.0000 F2400/g, "G1 E"+retDistExtra+" F"+retSpeed+" ; custom un-retraction/prime"); + baseline = baseline.replace(/;retract1\nG1 Z[0-9\.]+ F1200/g, ";retract1\n;zhop1"); + if(zhop > 0){ + baseline = baseline.replace(/;zhop1/g, "G91;\nG1 Z"+zhop+" F1200 ; custom z hop\nG90;"); + } + baseline = baseline.replace(/;retract1/g, "G1 E-"+retDist+" F"+retSpeed+" ; custom retraction"); + baseline = baseline.replace(/;unretract1/g, "G1 E"+retDistExtra+" F"+retSpeed+" ; custom un-retraction/prime"); if(abl == 1){ baseline = baseline.replace(/;G29 ; probe ABL/, "G29 ; probe ABL"); } @@ -369,8 +358,9 @@ function processRetraction(){ var bedX = Math.round((document.retractionForm.bedx.value-100)/2); var bedY = Math.round((document.retractionForm.bedy.value-100)/2); var abl = document.retractionForm.abl.value; - var pc = document.retractionForm.pc.value; - var pcResume = 255; + var fanLayer = document.retractionForm.fanLayer.value; + var fanPercentage = document.retractionForm.fanSpeed.value; + var fanSpeed = Math.round(fanPercentage*2.55); var a1 = document.retractionForm.ret_a1.value; var a2 = document.retractionForm.ret_a2.value*60; var a3 = document.retractionForm.ret_a3.value; @@ -402,34 +392,30 @@ function processRetraction(){ var f4 = document.retractionForm.ret_f4.value*60; var f5 = document.retractionForm.ret_f5.value; var customStart = document.retractionForm.startgcode.value; - var retraction = originalRetraction; - switch(pc){ - case '0': - retraction = retraction.replace(/;fan2/, "M106 S255 ; custom fan 100% from layer 2"); + var retraction = commonStart; + switch(nozzleLayer){ + case "40_20": + retraction += retraction_40_20; break; - case '1': - retraction = retraction.replace(/;fan3/, "M106 S255 ; custom fan 100% from layer 3"); - break; - case '2': - retraction = retraction.replace(/;fan5/, "M106 S255 ; custom fan 100% from layer 5"); - break; - case '3': - retraction = retraction.replace(/;fan2/, "M106 S130 ; custom fan 50% from layer 2"); - pcResume = 130; - break; - case '4': - retraction = retraction.replace(/;fan3/, "M106 S130 ; custom fan 50% from layer 3"); - pcResume = 130; - break; - case '5': - retraction = retraction.replace(/;fan5/, "M106 S130 ; custom fan 50% from layer 5"); - pcResume = 130; - break; - case '6': - retraction = retraction.replace(/;fan2/, "; custom fan off"); - pcResume = 0; + + case: "40_16": + retraction += retraction_40_16; break; } + retraction += commonEnd; + retraction = retraction.replace(/M106 S3/, ";"); + switch(fanLayer){ + case '2': + retraction = retraction.replace(/;fan2;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 2"); + break; + case '3': + retraction = retraction.replace(/;fan3;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 3"); + break; + case '5': + retraction = retraction.replace(/;fan5;/, "M106 S"+fanSpeed+"; custom fan "+fanPercentage+"% from layer 5"); + break; + } + retraction = retraction.replace(/M106 S3/g, "M106 S"+fanSpeed+"; custom fan "+fanSpeed+"%"); retraction = retraction.replace(/M140 S60/g, "M140 S"+bedTemp+" ; custom bed temp"); retraction = retraction.replace(/M190 S60/g, "M190 S"+bedTemp+" ; custom bed temp"); if(abl != 4){ @@ -500,11 +486,13 @@ function processRetraction(){ } } // A section - retraction = retraction.replace(/;retractionA/g, "G1 E-"+a1+" F"+a2+" ; custom retraction - A"); - retraction = retraction.replace(/;unretractionA/g, "G1 E"+a3+" F"+a4+" ; custom un-retraction/prime - A"); + retraction = retraction.replace(/;retract1\nG1 Z[0-9\.]+ F1200/g, ";retract1\n;zhop1"); if(a5 > 0){ - retraction = retraction.replace(/;zhopupA/g, "G91\nG1 Z"+a5+" F1200 ; custom z hop - A\nG90"); + retraction = retraction.replace(/;zhop1/g, "G91\nG1 Z"+a5+" F1200 ; custom z hop - A\nG90"); } + retraction = retraction.replace(/;retract1/g, "G1 E-"+a1+" F"+a2+" ; custom retraction - A"); + retraction = retraction.replace(/;unretract1/g, "G1 E"+a3+" F"+a4+" ; custom un-retraction/prime - A"); + // B section retraction = retraction.replace(/;retractionB/g, "G1 E-"+b1+" F"+b2+" ; custom retraction - B"); retraction = retraction.replace(/;unretractionB/g, "G1 E"+b3+" F"+b4+" ; custom un-retraction/prime - B"); @@ -887,7 +875,8 @@ function outputSettings(formName) { break; } string += " form\n_________________________________________________________________________\n\n"; - string += "All changes are marked in the gcode with 'custom' at the end of each line. Open the gcode in a text editor and search for this to your inputs if needed.\n\n"; + string += "G-Code originally generated by Simplify3D(R) Version 4.1.2\nThis calibration test gcode modified by the Teaching Tech Calibration website: https://teachingtechyt.github.io/calibration.html\n"; + string += "All changes are marked in the gcode with 'custom' at the end of each line. Open the gcode in a text editor and search for this to your check inputs if needed.\n\n"; if(formName.psuon.checked == true) { string += "Turn on PSU with M80 active\n" } @@ -924,8 +913,9 @@ function outputSettings(formName) { string += "Hot end: "+formName.hotendtemp.value+" deg C\n"; } if(formName.name != "firstlayerForm") { - var pcSelected = formName.pc.value; - string += "\n\nPart Cooling: "+formName.pc[pcSelected].text; + var fanSpeed = formName.fanSpeed.value; + var fanLayer = formName.fanLayer.value + string += "\n\nPart Cooling: "+fanSpeed+"% from layer "+fanLayer+"\n"; } var ablSelected = formName.abl.value; string += "\n\nABL: "+formName.abl[ablSelected].text; @@ -940,7 +930,8 @@ function outputSettings(formName) { } else { string += "\n\nRetraction distance: "+formName.retdist.value+" mm\n"; string += "Retraction speed: "+formName.retspeed.value+" mm/sec\n"; - //string += "Extra restart distance: "+formName.hotendtemp.value+" mm\n"; + string += "Extra restart distance: "+formName.retdistextra.value+" mm\n"; + string += "Z hop: "+formName.zhop.value+" mm\n"; } if(formName.name == "accelerationForm") { string += "\nBase feedrate: "+formName.feedrate.value+" mm/s\n\n"; diff --git a/js/loadscripts.js b/js/loadscripts.js index f4229db..bab0fe3 100644 --- a/js/loadscripts.js +++ b/js/loadscripts.js @@ -7,6 +7,7 @@ var scripts = ` + diff --git a/js/retraction.js b/js/retraction.js index 919b145..0f7bd3e 100644 --- a/js/retraction.js +++ b/js/retraction.js @@ -1,16 +1,4 @@ -var originalRetraction = `; G-Code originally generated by Simplify3D(R) Version 4.1.2 -;M80 ; power supply on -G90 -M82 -M106 S0 -M140 S60 -M190 S60 -M104 S210 T0 -M109 S210 T0 -G28 ; home all axes -;G29 ; probe ABL -;M420 S1 ; restore ABL mesh -;customstart +var retraction_40_20 = ` ; process Color1-2 ; layer 1, Z = 0.200 T0 @@ -72398,10 +72386,4 @@ G1 X77.387 Y49.766 E1.5740 G1 X75.775 Y51.377 E1.6558 G92 E0.0000 ;retractionF -; layer end -G28 X0 ; home X axis -M106 S0 ; turn off cooling fan -M104 S0 ; turn off extruder -M140 S0 ; turn off bed -M84 ; disable motors ` \ No newline at end of file diff --git a/troubleshooting.html b/troubleshooting.html index b979fb9..99ac7bb 100644 --- a/troubleshooting.html +++ b/troubleshooting.html @@ -30,7 +30,7 @@

Watch the video, read this tab, prepare yourself with the appropriate tools and then work through relevant tabs.

Understand your machine before attempting modification

Perhaps you have arrived at this page with a standard printer that has broken down. In this case, ignore this heading. Many people, however, will arrive at this page after performing modifications to their machine. When they try to turn it back on, something doesn't work as expected.

-

Often people fall into the trap of modifying a 3D printer as a beginner, immediately after purchase. This can be quite risky. Firstly, they do not have a good working knowlegde of how their printer functions. They have not seen it in action long enough to what the purpose of each component is, which increases the chance of components being reinstalled incorrectly.

+

Often people fall into the trap of modifying a 3D printer as a beginner, immediately after purchase. This can be quite risky. Firstly, they do not have a good working knowledge of how their printer functions. They have not seen it in action long enough to know what the purpose of each component is, which increases the chance of components being reinstalled incorrectly.

Another potential problem is that the user will not appreciate the benefits of the upgrade because they have not worked with the printer in its 'inferior' standard state. In some cases something like an ABL probe will be fitted immediately, before the user understands how to manually level the bed. The rush to upgrade deprives the user of learning the fundamentals necessary for efficient and effective long term operation. I am a fan of using ABL for the added convenience and the ability to compensate for a warped bed, but this is because I spent many years without ABL on a less than precise printer.

Be methodical: only test/change/modify one aspect at a time

Beginners often tear down a printer and upgrade multiple things at once, which means when it goes back together and doesn't work they have no idea which new component is the problem.