include("GCode.js"); // Machine Configuration for LinuxCNC Plasma type machines in Inch function Lcnc_Plasma(documentInterface, newDocumentInterface) { GCode.call(this, documentInterface, newDocumentInterface); // set output unit: this.unit = RS.Inch; // use 'Lcnc_PlasmaLayer.ui' for layer options instead of 'GCodeLayer.ui': this.layerOptions = "Lcnc_PlasmaLayer"; } Lcnc_Plasma.prototype = new GCode(); // get the nozzle type Lcnc_Plasma.prototype.getTorchNozzle = function() { return layer.getCustomProperty("QCADCAM", "Cam/TorchNozzle", 1); System.out.println("Hello World"); }; // add subroutine call to fire the torch Lcnc_Plasma.prototype.writeToolDown = function() { this.g = GCode.Mode.Normal; this.z = this.getToolDownLevel(); this.toolPosition = GCode.ToolPosition.Down; this.torchNozzle = this.getTorchNozzle(); // this seems to put the program in a loop this.writeLine(); // this is the Z down move this.writeLine("o call"); //this.writeLine(this.torchNozzle); this.toolIsDown(); }; // turn the torch off Lcnc_Plasma.prototype.writeToolUp = function() { this.g = GCode.Mode.Rapid; this.z = this.getToolUpLevel(); this.toolPosition = GCode.ToolPosition.Up; if (this.feedRateSet!==true) { this.writeLine(undefined, "F200"); this.feedRateSet=true; } else { this.writeLine("M5"); this.writeLine(); } this.toolIsUp(); }; // change file extension from nc to ngc Lcnc_Plasma.prototype.getFileExtensions = function() { // set output file extension: return ["ngc"]; }; // change default to inch Lcnc_Plasma.prototype.initGlobalOptionWidget = function(w) { switch (w.objectName) { case "ZSafety": w.addItems(["2", "1", "0.5"]); // available options in combo box w.setEditText("0.5"); // preselected default option break; case "ZClear": w.addItems(["0.25", "0.5", "1"]); w.setEditText("0.25"); break; case "ZCutting": w.addItems(["-0.125", "-0.25", "-0.5"]); w.setEditText("-0.125"); break; } }; // set pierce options Lcnc_Plasma.prototype.initLayerOptionWidget = function(w) { switch (w.objectName) { case "PierceHeight": w.addItems(["0.125", "0.150", "0.175"]); w.setEditText = "0.125"; break; case "PierceDelay": w.addItems(["0.5", "1.0", "1.5"]); w.setEditText = "0.0"; break; case "CutHeight": w.addItems(["0.125", "0.150", "0.175"]); w.setEditText = "0.125"; break; case "TorchNozzle": w.addItems(["FC", "40a", "60a", "80a"]); w.setEditText = "FC"; break; case "MaterialThickness": w.addItems(["16ga", "14ga", "12ga", "11ga", "3/16", "1/4", "3/8"]); w.setEditText = "12ga"; break; } }; // change G00 to G0 Lcnc_Plasma.prototype.getRapidMoveCode = function() { return "G0"; }; // change G01 to G1 Lcnc_Plasma.prototype.getLinearMoveCode = function() { return "G1"; }; // change G02 to G2 Lcnc_Plasma.prototype.getCircularCWMoveCode = function() { return "G2"; }; // change G03 to G3 Lcnc_Plasma.prototype.getCircularCCWMoveCode = function() { return "G3"; }; // add preamble GCode.prototype.writeHeader = function() { this.writeLine("G20 G17 G40 G49 G54 G64 P0.005 G80 G90 G94"); this.writeRapidZMove(this.getSafetyZLevel()); this.toolPosition = GCode.ToolPosition.Clear; }; // change M30 to M2 Lcnc_Plasma.prototype.writeFooter = function() { this.writeToolUp(); this.writeRapidZMove(this.getSafetyZLevel()); this.toolPosition = GCode.ToolPosition.Clear; this.writeLine("M2"); }; // turn off line numbers Lcnc_Plasma.prototype.getLineNumberCode = function() { return ""; }; // drill at points Lcnc_Plasma.prototype.exportPoint = function(point) { // tool up and move to position of point: this.writeToolUp(); this.rapidMove(point.getPosition()); // point position in target coordinates, write rapid move: var pointTarget = this.convert(point.getPosition()); this.writeRapidLinearMove(pointTarget.x, pointTarget.y); // process point (default: tool down, tool up): this.writeToolDown(); this.writeToolUp(); // add point to output (for preview purposes only): var entity = new RPointEntity(this.newDocument, new RPointData(pointTarget)); entity.setLayerId(this.getCamLayerId()); this.op.addObject(entity, false); this.cursor = point.getPosition(); };