Please use the following video as a guide to this test:
@@ -1044,6 +1034,14 @@
Fixing persistent dimensional accuracy after X/Y/Z steps per unit have been
One final measure, that is the least desirable, is to design parts to be printed bigger or smaller to compensate. This is a band aid approach and falls apart very quickly once we print geometry designed by other people.
+
+
diff --git a/js/commongcode.js b/js/commongcode.js
index 7d2ba1a..09091ed 100644
--- a/js/commongcode.js
+++ b/js/commongcode.js
@@ -1,6 +1,4 @@
-var commonStart = `; G-Code originally generated by Simplify3D(R) Version 4.1.2
-; This calibration test gcode modified by the Teaching Tech Calibration website: https://teachingtechyt.github.io/calibration.html
-;M80 ; power supply on
+var commonStart = `;M80 ; power supply on
G90
M82
M106 S0
diff --git a/js/createform.js b/js/createform.js
index d370596..4b6d7e7 100644
--- a/js/createform.js
+++ b/js/createform.js
@@ -326,6 +326,28 @@ var endGcode = /*html*/ `
Additional end gcode
var preview = /*html*/ `
It is advised to preview the generated gcode through your slicer or Gcode.ws before printing.`;
+var downloadGcodeHtml = /*html*/ `
Download
+
+
+
+
+
+
+
Octoprint / Moonraker
+
You can directly print from this website if you specify Octoprint or Moonraker server.
+
+
+
+
+
+
Login to your Octoprint
+
or get API Key go to User Settings > Application Keys and manually generate new application key.
+
Restart afterwards
+
+
+
+`;
+
function createForm(n){
document.write('')
document.write(nozzleLayer);
@@ -357,4 +379,5 @@ function createForm(n){
}
document.write(endGcode);
document.write(preview);
-}
\ No newline at end of file
+ document.write(downloadGcodeHtml.replaceAll('{formName}', n));
+}
diff --git a/js/gcodeprocessing.js b/js/gcodeprocessing.js
index 927ce74..c57df76 100644
--- a/js/gcodeprocessing.js
+++ b/js/gcodeprocessing.js
@@ -112,7 +112,6 @@ function updateFeeds(feedrate) {
function processGcode(formName) {
var name = formName.name;
- var description = formName.description.value;
var nozzleLayer = formName.nozzleLayer.value;
var bedTemp = formName.bedtemp.value;
var centre = formName.centre.checked;
@@ -544,37 +543,14 @@ function processGcode(formName) {
if(formName.deltaHome.checked == true) {
gcode = gcode.replace(/G28 X0 ; home X axis/, "G28 ; home all on delta");
}
-
- // process finished gcode file
- downloadFile(description+'.gcode', gcode);
+
+ return gcode;
}
function outputSettings(formName) {
- var fileName;
- var string = "Settings for ";
- switch(formName.name) {
- case "firstlayerForm":
- string += "first layer"
- fileName = "firstlayersettings.txt";
- break;
- case "baselineForm":
- string += "baseline print"
- fileName = "baselinesettings.txt";
- break;
- case "retractionForm":
- string += "retraction tuning"
- fileName = "retractionsettings.txt";
- break;
- case "temperatureForm":
- string += "temperature tuning"
- fileName = "temperaturesettings.txt";
- break;
- case "accelerationForm":
- string += "acceleration and jerk/junction deviation tuning"
- fileName = "accelerationsettings.txt";
- break;
- }
- string += " form\n_________________________________________________________________________\n\n";
+ var string = "";
+ string += "Settings for " + formName.description.value + " form\n";
+ string += "_________________________________________________________________________\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) {
@@ -653,6 +629,60 @@ function outputSettings(formName) {
string += " B | "+formName.accel_b1.value+" mm/sec/sec | "+formName.accel_b4.value+"\n";
string += " A | "+formName.accel_a1.value+" mm/sec/sec | "+formName.accel_a4.value+"\n";
}
- }
- downloadFile(fileName, string);
+ }
+ return string;
+}
+
+function getGcodeAndSettings(form) {
+ var gcode = processGcode(form);
+ var settings = outputSettings(form);
+
+ var output = "";
+ // prefix each line with ; to indicate comment
+ output += "; " + settings.replaceAll("\n", "\n; ");
+ output += gcode;
+ return output;
+}
+
+function downloadGcode(form, fileName) {
+ if (!fileName) {
+ fileName = form.description.value + ".gcode";
+ }
+
+ downloadFile(fileName, getGcodeAndSettings(form));
+}
+
+function downloadSettings(form, fileName) {
+ if (!fileName) {
+ fileName = form.description.value + "settings.txt";
+ }
+
+ downloadFile(fileName, outputSettings(form));
+}
+
+function uploadGcode(form, fileName) {
+ var output = getGcodeAndSettings(form);
+
+ if (!form.octoprint_url.value) {
+ alert("No URL specified for Octoprint or Moonraker.");
+ return;
+ }
+
+ // get only basename
+ if (!fileName) {
+ fileName = form.description.value + ".gcode";
+ }
+ fileName = fileName.split('/').reverse()[0];
+
+ // remove `/` from the end of URL
+ var url = form.octoprint_url.value.replace(/\/$/, '');
+ url += "/api/files/local";
+
+ const dataTransfer = new DataTransfer();
+ dataTransfer.items.add(new File([output], fileName, {type : 'text/plain'}));
+
+ document.octoprintForm.action = url;
+ document.octoprintForm.file.files = dataTransfer.files;
+ document.octoprintForm.apikey.value = form.octoprint_key.value;
+ document.octoprintForm.submit();
}
diff --git a/js/persist.js b/js/persist.js
index 548d312..38a03da 100644
--- a/js/persist.js
+++ b/js/persist.js
@@ -17,6 +17,7 @@ function loadFormData(form) {
element.tagName == "INPUT" && element.type == "checkbox" ||
element.tagName == "INPUT" && element.type == "radio" ||
element.tagName == "INPUT" && element.type == "text" ||
+ element.tagName == "INPUT" && element.type == "password" ||
element.tagName == "TEXTAREA" ||
element.tagName == "SELECT"
) {