include("GCode.js"); function Spesmek(documentInterface, newDocumentInterface) { GCode.call(this, documentInterface, newDocumentInterface); // cut inner contours before outer contours (default): this.innerBeforeOuter = true; // always write G-code, even if it is the same as on the previous line: this.alwaysWriteGCode = true; // split circles into two halves (default): this.splitFullCircles = true; // use Spesmek.ui for global options: this.globalOptions = "Spesmek"; // no layer options: this.layerOptions = undefined; } Spesmek.prototype = new GCode(); /** * Return the file extension to use here. */ Spesmek.prototype.getFileExtensions = function() { return ["nc"]; }; /** * Configure selectable default values for global options. */ Spesmek.prototype.initGlobalOptionWidget = function(w) { switch (w.objectName) { case "WaitTime": w.addItems(["0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "1.0", "2.0", "3.0"]); w.setEditText("0.5"); break; case "Feedrate": w.addItems(["100", "200", "300", "400", "500"]); w.setEditText("200"); break; } }; Spesmek.prototype.initLayerOptionWidget = function(w) { }; /** * Returns the wait time the user has chosen. */ Spesmek.prototype.getWaitTime = function() { return parseFloat(this.document.getVariable("Cam/WaitTime", 0.5)); }; /** * Disables line numbers. */ Spesmek.prototype.getLineNumberCode = function() { return ""; }; /** * Called to switch Laser off. */ Spesmek.prototype.writeToolUp = function() { this.writeLine("M5"); this.toolIsUp(); }; /** * Called to switch Laser on. */ Spesmek.prototype.writeToolDown = function() { this.writeLine("M3"); if (this.getWaitTime() > 1.0e-6) { this.writeLine("G4 P" + this.getWaitTime()); } this.toolIsDown(); }; /** * Called in the beginning of the program. */ Spesmek.prototype.writeHeader = function() { this.writeLine("G64 P0.05 G21"); this.toolIsUp(); this.f = this.getFeedrate(); }; /** * Called in the end of the program. */ Spesmek.prototype.writeFooter = function() { this.writeToolUp(); this.writeLine("M2"); };