forked from LaserWeb/deprecated-LaserWeb1
-
Notifications
You must be signed in to change notification settings - Fork 0
3rd Party GCODE API
Peter van der Walt edited this page Jan 28, 2016
·
5 revisions
Did you know? You can post Gcode from any app to http://ip-of-laserweb/api/upload?
See https://github.com/openhardwarecoza/LaserWeb/blob/master/server.js#L106 and https://github.com/openhardwarecoza/LaserWeb/blob/master/i/main.js#L300
You can use this example in your own applications. Preferably make the LaserWeb IP configurable, many of our users run it on a Pi or something not-local
var myGCodeSstoredinaVariableHere = "G1 F10000 Z-3 \n G1 F6500 X10 Y10 \n G1 F6500 X10 Y52.965154503616 \n G1 F6500 X18.2182774490467"
function SendGcodeToLaserweb() {
var alert = showAlert("Sending gcode to LaserWeb", "alert-info", false);
$.ajax({
url: "http://ip-of-laserweb/api/upload", // Or Use a relative url
type: "POST",
data: { val: myGCodeSstoredinaVariableHere },
dataType: "json",
})
.done(function (content) {
alert.remove();
})``
.fail(function (e) {
alert.remove();
showAlert("Failed to post gcode data to LaserWeb", "alert-danger");
});
}
Want to Help?
- Help reach a Milestones
- Add some content to the Wiki
- Share this with your friends
- Sponsor a contributor