Add retraction tuning

This commit is contained in:
lawgicau
2020-08-12 12:59:16 +10:00
parent ce8a871108
commit ba4296f421
6 changed files with 102066 additions and 8 deletions

View File

@ -88,6 +88,10 @@ li {
table {
width: 100%;
margin-bottom: 20px;
}
table input {
margin:0;
}
th {

29402
files/retractiontest.stl Normal file

File diff suppressed because it is too large Load Diff

BIN
img/retractiondiagram.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -11,6 +11,7 @@
<script src="js/videobox.js"></script>
<script src="js/featherlight.js"></script>
<script src="js/baseline.js"></script>
<script src="js/retraction.js"></script>
<script src="js/encoding-indexes.js"></script>
<script src="js/encoding.js"></script>
<script src="js/gcodeprocessing.js"></script>
@ -123,17 +124,19 @@
<option value="1">50% fan from layer 2</option>
<option value="2">No constant fan</option>
</select>
<h4>Retraction</h4>
<p>For intial tests, 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.</p>
<label>Retraction distance (mm): <input type="number" name="retdist" value="5" min="0" max="20"></label>
<label>Retraction speed (mm/sec): <input type="number" name="retspeed" value="40" min="5" max="150"></label><br />
<h4>Auto Bed Levelling</h4>
<label for="abl">Select which method of ABL is in place.</label>
<select name="abl">
<option value="0">No ABL</option>
<option value="1">Probe new mesh at the start of print - G29</option>
<option value="2">Restore saved mesh - M420 S1</option>
<option value="3">Prusa MK3 - G28 W followed by M80</option>
</select>
<h4>Retraction</h4>
<p>For intial tests, 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.</p>
<label>Retraction distance (mm): <input type="number" name="retdist" value="5" min="0" max="20"></label>
<label>Retraction speed (mm/sec): <input type="number" name="retspeed" value="40" min="5" max="150"></label><br />
<p><input type="button" onclick="processBaseline()" value="Download Gcode"></p>
</form>
<p>If there are no major issues, please continue to the next step. If there is a significant defect, the culprit will likely be found on the frame page.</p>
@ -238,7 +241,6 @@
<td>Filament settings > Filament > Extrusion multiplier: 1</td>
</tr>
</tbody>
</table>
<p>Now slice and print!</p>
<p>Use vernier calipers to measure the outer wall thickness of the hollow cube. Take measurements in multiple places/sides.</p>
@ -372,8 +374,142 @@
</div>
<div id="retraction">
<h2>Retraction Tuning</h2>
<p></p>
<div class="exp">
<h2>Retraction Tuning</h2>
<h5>Aim:</h5>
<p>To set the correct parameters concerning retraction during 3D printing, including retraction distance, speed, Z hop and extra restart distance.</p>
<h5>Required:</h5>
<p>Initial calibration, any time the hot end or extruder is changed, when trying a new type/brand of filament.</p>
</div>
<p>FDM works by melting plastic filament and extruding it accurately one layer at a time to build up 3D geometry. By its nature, the plastic will continue to ooze and drip out of the nozzle even when not pushed byy the extruder. To combat this, our slicers use retraction, where the filament is withdrawn from the hot end, aleviating pressure and minimising ooze. When properly tuned, this has the effect of removing stringing, the unwanted oozing of plastic between two points of the model.</p>
<div class="exp">
<h5>Special note:</h5>
<p>Temperature tuning and retraction tuning are related to each other. You could do them in either order, and it may be necessary to tune back and forth to reach an ideal result. A higher nozzle temperature will promote more oozing and stringing, whereas a lower temperature will reduce oozing and stringing.</p>
</div>
<p>Besides hot end temperature, there are four parameters we will be tuning relating to retraction. In the table is a description of each as well as where the setting is found n the most popular slicers.</p>
<table>
<head>
<tr>
<th>Retraction Parameter</th>
<th>Cura</th>
<th>Simplify3D</th>
<th>PrusaSlicer</th>
</tr>
</head>
<tbody>
<tr>
<td>Retraction distance: The amount of filament that is pulled away from the nozzle.</td>
<td>Travel > Retraction distance</td>
<td>Extruder > Retraction distance</td>
<td>Printer settings > Extruder 1 > Retraction > Length</td>
</tr>
<tr>
<td>Retraction speed: The speed at which this filament is withdrawn in mm/sec.</td>
<td>Travel > Retraction speed</td>
<td>Extruder > Retraction speed</td>
<td>Printer settings > Extruder 1 > Retraction > Retraction Speed</td>
</tr>
<tr>
<td>Extra restart distance: The retraction distance will be reveresed when the travel (non-extruding) movement is over. This is typicaly zero, but you can opt for extra filament to be extruded (a positive value) or less than than what was retracted (a negative value).</td>
<td>Travel > Retraction extra prime amount</td>
<td>Extruder > Extra restart distance</td>
<td>Printer settings > Extruder 1 > Retraction > Extra length on restart</td>
</tr>
</tbody>
</table>
<div class="exp">
<h5>Other factors beyond the scope of this test:</h5>
<ul>
<li>Retraction acceleration: This will affect if the retraction speed can actually be reached. The gcode below does not include any changes to what is set on your printer. You can change this with <a href="https://marlinfw.org/docs/gcode/M204.html" target="_blank">M204</a> and the <b>R</b> argument.</li>
<li>Slicer settings such as coast: Coast stops extrusion slightly early to assist retraction. This varies from slicer to slicer and isn't always necessary to tune.</li>
<li>Linear advance: Linear advance, covered later in this guide, can drastically improve the accuracy of our extrusion. It has a significant impact of retraction (reducing the need), so after configuring linear advance you may need to revisit retraction.</li>
<li>Z hop: The amount the nozzle lifts vertically in mm during a travel (non-extruding) movement. this could have potentially minor impact on stringing. the generator below has this fixed at <b>0.4mm</b>.</li>
<li>Slicer differences: The gcode generated below was originally sliced by Simplify3D. The settings you establish should translate to your slicer quite well but there may be idiosyncrasies. For ijstance, Cura measures extra restart distance in volume rather than length.</li>
</ul>
</div>
<p>The following form will create a retraction tower to conveniently test back to back parameters in the same print. Of the four available parameters, it is best to change only one per test print. For example, keep the retraction speed, z hop and exta 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.</p>
<form name="retractionForm" id="retractionForm" onsubmit="return false;">
<h4>Bed dimensions</h4>
<p>Inputting the correct number will attempt to move the print into the centre of the bed. In the centre button is checked, the bed size is irrelevant. Please check the gcode to ensure it will fit on your bed.</p>
<label>0,0 at centre of bed (Delta):<input name="centre" type="checkbox" onchange="toggle(this.checked, '#retractionXY')" value="centre"></label>
<span id="retractionXY"><label>Bed X dimension (mm): <input type="number" name="bedx" value="100" min="100" max="600" step="1"></label>
<label>Bed Y dimension (mm): <input type="number" name="bedy" value="100" min="100" max="600" step="2"></label><br /></span>
<h4>Temperatures</h4>
<p>For the hot end and bed respectively, typical PLA temperatures are 200 and 60, PETG 235 and 80, ABS 250 and 100, TPU 230 and 5 (effectively off).</p>
<label>Hot end temperature (deg C): <input type="number" name="hotendtemp" value="200" min="160" max="450"></label>
<label>Bed temperature (deg C): <input type="number" name="bedtemp" value="60" min="5" max="150"></label><br />
<h4>Part Cooling Fan</h4>
<p>PLA typically has the part cooling fan come on from layer 2. Alter this default bahaviour here:</p>
<label for="pc">Select part cooling fan behaviour:</label>
<select name="pc">
<option value="0">100% fan from layer 2</option>
<option value="1">50% fan from layer 2</option>
<option value="2">No constant fan</option>
</select>
<h4>Auto Bed Levelling</h4>
<label for="abl">Select which method of ABL is in place.</label>
<select name="abl">
<option value="0">No ABL</option>
<option value="1">Probe new mesh at the start of print - G29</option>
<option value="2">Restore saved mesh - M420 S1</option>
<option value="3">Prusa MK3 - G28 W followed by M80</option>
</select>
<h4>Retraction</h4>
<p>For intial tests, 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. Vary either side of this for each segment.</p>
<table>
<thead>
<tr>
<th>Reference Diagram</th>
<th>Segment</th>
<th>Retraction distance</th>
<th>Retraction speed</th>
<th>Extra restart distance</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="6">
<img src="img/retractiondiagram.jpg" />
</td>
<td style="text-align: center;">F</td>
<td><input type="number" min="0" max="20" name="f1" value="6"></td>
<td><input type="number" min="5" max="200" name="f2" value="40"></td>
<td><input type="number" min="-10" max="10" name="f3" value="0"></td>
</tr>
<tr>
<td style="text-align: center;">E</td>
<td><input type="number" min="0" max="20" name="e1" value="6"></td>
<td><input type="number" min="5" max="200" name="e2" value="40"></td>
<td><input type="number" min="-10" max="10" name="e3" value="0"></td>
</tr>
<tr>
<td style="text-align: center;">D</td>
<td><input type="number" min="0" max="20" name="d1" value="6"></td>
<td><input type="number" min="5" max="200" name="d2" value="40"></td>
<td><input type="number" min="-10" max="10" name="d3" value="0"></td>
</tr>
<tr>
<td style="text-align: center;">C</td>
<td><input type="number" min="0" max="20" name="c1" value="6"></td>
<td><input type="number" min="5" max="200" name="c2" value="40"></td>
<td><input type="number" min="-10" max="10" name="c3" value="0"></td>
</tr>
<tr>
<td style="text-align: center;">B</td>
<td><input type="number" min="0" max="20" name="b1" value="6"></td>
<td><input type="number" min="5" max="200" name="b2" value="40"></td>
<td><input type="number" min="-10" max="10" name="b3" value="0"></td>
</tr>
<tr>
<td style="text-align: center;">A</td>
<td><input type="number" min="0" max="20" name="a1" value="6"></td>
<td><input type="number" min="5" max="200" name="a2" value="40"></td>
<td><input type="number" min="-10" max="10" name="a3" value="0"></td>
</tr>
</tbody>
</table>
<p><input type="button" onclick="processRetraction()" value="Download Gcode"></p>
</form>
</div>
<div id="temp">

View File

@ -62,7 +62,7 @@ function processBaseline(){
var abl = document.baselineForm.abl.value;
var pc = document.baselineForm.pc.value;
var baseline = originalBaseline;
if(apc == 1){
if(pc == 1){
baseline = baseline.replace(/M106 S255/, "M106 S130");
}
if(pc == 2){
@ -74,6 +74,10 @@ function processBaseline(){
if(abl == 2){
baseline = baseline.replace(/;M420 S1 ; restore ABL mesh/, "M420 S1 ; restore ABL mesh");
}
if(abl == 3){
baseline = baseline.replace(/G28 ; home all axes/, "G28 W ; home all without mesh bed level")
baseline = baseline.replace(/;G29 ; probe ABL/, "G80 ; mesh bed leveling")
}
baseline = baseline.replace(/M140 S60/g, "M140 S"+bedTemp);
baseline = baseline.replace(/M190 S60/g, "M140 S"+bedTemp);
baseline = baseline.replace(/M104 S210/g, "M104 S"+hotendTemp);
@ -125,3 +129,112 @@ function processBaseline(){
downloadFile('baseline.gcode', baseline);
}
function processRetraction(){
var hotendTemp = document.retractionForm.hotendtemp.value;
var bedTemp = document.retractionForm.bedtemp.value;
var centre = document.retractionForm.centre.checked;
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 a1 = document.retractionForm.a1.value;
var a2 = document.retractionForm.a2.value*60;
var a3 = document.retractionForm.a3.value;
var b1 = document.retractionForm.b1.value;
var b2 = document.retractionForm.b2.value*60;
var b3 = document.retractionForm.b3.value;
var c1 = document.retractionForm.c1.value;
var c2 = document.retractionForm.c2.value*60;
var c3 = document.retractionForm.c3.value;
var d1 = document.retractionForm.d1.value;
var d2 = document.retractionForm.d2.value*60;
var d3 = document.retractionForm.d3.value;
var e1 = document.retractionForm.e1.value;
var e2 = document.retractionForm.e2.value*60;
var e3 = document.retractionForm.e3.value;
var f1 = document.retractionForm.f1.value;
var f2 = document.retractionForm.f2.value*60;
var f3 = document.retractionForm.f3.value;
var retraction = originalRetraction;
if(pc == 1){
retraction = retraction.replace(/M106 S255/, "M106 S130");
}
if(pc == 2){
retraction = retraction.replace(/M106 S255/, ";M106 S255");
}
if(abl == 1){
retraction = retraction.replace(/;G29 ; probe ABL/, "G29 ; probe ABL");
}
if(abl == 2){
retraction = retraction.replace(/;M420 S1 ; restore ABL mesh/, "M420 S1 ; restore ABL mesh");
}
if(abl == 3){
retraction = retraction.replace(/G28 ; home all axes/, "G28 W ; home all without mesh bed level")
retraction = retraction.replace(/;G29 ; probe ABL/, "G80 ; mesh bed leveling")
}
retraction = retraction.replace(/M140 S60/g, "M140 S"+bedTemp);
retraction = retraction.replace(/M190 S60/g, "M140 S"+bedTemp);
retraction = retraction.replace(/M104 S210/g, "M104 S"+hotendTemp);
retraction = retraction.replace(/M109 S210/g, "M109 S"+hotendTemp);
if(centre == true){
var retractionArray = retraction.split(/\n/g);
var regexp = /X\d+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/X/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50;
retractionArray[item] = retractionArray[item].replace(regexp, "X"+String(value));
}
});
var regexp = /Y\d+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/Y/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) - 50;
retractionArray[item] = retractionArray[item].replace(regexp, "Y"+String(value))
}
});
retraction = retractionArray.join("\n");
} else {
if(bedX > 0){
var retractionArray = retraction.split(/\n/g);
var regexp = /X\d+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/X/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) + bedX;
retractionArray[item] = retractionArray[item].replace(regexp, "X"+String(value));
}
});
retraction = retractionArray.join("\n");
}
if(bedY > 0){
var retractionArray = retraction.split(/\n/g);
var regexp = /Y\d+/;
retractionArray.forEach(function(index, item){
if(retractionArray[item].search(/Y/) > -1){
var value = parseInt(retractionArray[item].match(regexp)[0].substring(1)) + bedY;
retractionArray[item] = retractionArray[item].replace(regexp, "Y"+String(value))
}
});
retraction = retractionArray.join("\n");
}
}
// A section
retraction = retraction.replace(/G1 E-6.0000 F900/g, "G1 E-"+a1+" F"+a2);
retraction = retraction.replace(/G1 E0.4000 F900/g, "G1 E"+a3+" F"+a2);
// B section
retraction = retraction.replace(/G1 E-7.0000 F1200/g, "G1 E-"+b1+" F"+b2);
retraction = retraction.replace(/G1 E0.6000 F1200/g, "G1 E"+b3+" F"+b2);
// C section
retraction = retraction.replace(/G1 E-8.0000 F1500/g, "G1 E-"+c1+" F"+c2);
retraction = retraction.replace(/G1 E0.8000 F1500/g, "G1 E"+c3+" F"+c2);
// D section
retraction = retraction.replace(/G1 E-9.0000 F1800/g, "G1 E-"+d1+" F"+d2);
retraction = retraction.replace(/G1 E1.0000 F1800/g, "G1 E"+d3+" F"+d2);
// E section
retraction = retraction.replace(/G1 E-10.0000 F2100/g, "G1 E-"+e1+" F"+e2);
retraction = retraction.replace(/G1 E1.2000 F2100/g, "G1 E"+e3+" F"+e2);
// F section
retraction = retraction.replace(/G1 E-11.0000 F2400/g, "G1 E-"+f1+" F"+f2);
retraction = retraction.replace(/G1 E1.4000 F2400/g, "G1 E"+f3+" F"+f2);
downloadFile('retraction.gcode', retraction);
}

72403
js/retraction.js Normal file

File diff suppressed because it is too large Load Diff