/* LinuxCNC Plasma configuration. */ include("GCode.js"); function Plasma(documentInterface, newDocumentInterface) { GCode.call(this, documentInterface, newDocumentInterface); // set output unit: this.unit = RS.Inch; // 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 Plasma.ui for global options: this.globalOptions = "Plasma"; // no layer options: this.layerOptions = undefined; } Plasma.prototype = new GCode(); // change file extension to ngc Plasma.prototype.getFileExtensions = function() { // set output file extension: return ["ngc"]; }; // init Global Options Plasma.prototype.initGlobalOptionWidget = function(w) { switch (w.objectName) { case "Nozzle": w.addItems(["manual", "FC", "40a", "60a", "80a"]); w.setEditText("Pick Nozzle"); break; case "Thickness": w.addItems(["manual", "16ga", "14ga", "12ga", "11ga", "3/16", "1/4", "3/8", "1/2", "5/8"]); w.setEditText("16ga"); break; case "Thickness_FC": w.addItems(["16ga", "14ga", "12ga", "11ga"]); w.setEditText("16ga"); break; case "Thickness_40a": w.addItems(["11ga", "3/16", "1/4"]); w.setEditText("11ga"); break; case "Thickness_60a": w.addItems(["3/16", "1/4", "3/8"]); w.setEditText("3/16"); break; case "Thickness_80a": w.addItems(["3/8", "1/2", "5/8"]); w.setEditText("3/8"); break; } }; // disable layer options Plasma.prototype.initLayerOptionWidget = function(w) { }; // turn off line numbers Plasma.prototype.getLineNumberCode = function() { return ""; }; // return the nozzle selected Plasma.prototype.getNozzle = function() { return this.document.getVariable("Cam/Nozzle", "none"); }; // return the material thickness Plasma.prototype.getThickness = function() { return this.document.getVariable("Cam/Thickness", "none"); }; // change G00 to G0 Plasma.prototype.getRapidMoveCode = function() { return "G0"; }; // change G01 to G1 Plasma.prototype.getLinearMoveCode = function() { return "G1"; }; // change G02 to G2 Plasma.prototype.getCircularCWMoveCode = function() { return "G2"; }; // change G03 to G3 Plasma.prototype.getCircularCCWMoveCode = function() { return "G3"; }; Plasma.prototype.getCuttingInfo = function(nozzle, thickness){ this.settings=new Object(); switch(nozzle){ case "FC": switch(thickness){ case "16ga": this.settings = {amps:"40", voltage:"71", pierce:"0.080", delay:"0", cut:"0.080", feed:"150"}; break; case "14ga": this.settings = {amps:"40", voltage:"79", pierce:"0.080", delay:"0", cut:"0.080", feed:"135"}; break; case "12ga": this.settings = {amps:"40", voltage:"81", pierce:"0.080", delay:"0", cut:"0.080", feed:"135"}; break; case "11ga": this.settings = {amps:"40", voltage:"82", pierce:"0.080", delay:"0", cut:"0.080", feed:"135"}; break; } break; case "40a": switch(thickness){ case "12ga": this.settings = {amps:"40", voltage:"145", pierce:"0.0625", delay:"0.35", cut:"0.0625", feed:"160"}; break; case "11ga": this.settings = {amps:"40", voltage:"146", pierce:"0.0625", delay:"0.45", cut:"0.0625", feed:"129"}; break; case "3/16": this.settings = {amps:"40", voltage:"147", pierce:"0.0625", delay:"0.75", cut:"0.0625", feed:"63"}; break; case "1/4": this.settings = {amps:"40", voltage:"149", pierce:"0.0625", delay:"1.00", cut:"0.0625", feed:"48"}; break; } break; case "60a": switch(thickness){ case "1/4": this.settings = {amps:"60", voltage:"138", pierce:"0.0625", delay:"0.25", cut:"0.0625", feed:"86"}; break; case "3/8": this.settings = {amps:"60", voltage:"141", pierce:"0.0625", delay:"0.75", cut:"0.0625", feed:"41"}; break; case "1/2": this.settings = {amps:"60", voltage:"141", pierce:"0.0625", delay:"1.50", cut:"0.0625", feed:"27"}; break; } break; case "80a": switch(thickness){ case "3/8": this.settings = {amps:"80", voltage:"137", pierce:"0.0625", delay:"0.50", cut:"0.0625", feed:"61"}; break; case "1/2": this.settings = {amps:"80", voltage:"140", pierce:"0.0625", delay:"0.50", cut:"0.0625", feed:"39"}; break; case "5/8": this.settings = {amps:"80", voltage:"145", pierce:"0.0625", delay:"1.00", cut:"0.0625", feed:"26"}; break; default: this.settings = {amps: "none"} } break; } return this.settings; }; // add preamble Plasma.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; }; // probe for material top and fire the torch Plasma.prototype.writeToolDown = function() { this.g = GCode.Mode.Normal; this.z = this.getToolDownLevel(); this.nozzle = this.getNozzle(); this.thickness = this.getThickness(); this.settings = this.getCuttingInfo(this.getNozzle(),this.getThickness()); qDebug("radio " + this.getRadioCheckedValue("buttonGroup")); //this.radio = this.getRadio(); //if(undefined != this.settings.amps){ // qDebug("amps undefined"); //} qDebug("amps " + this.settings.amps); //this.settings = this.getPlasmaInfo(this.getNozzle(),this.getThickness()); //var cutsettings = "[" + this.settings.pierce + "]"; //cutsettings += "[" + this.settings.delay + "]"; //cutsettings += "[" + this.settings.cut + "]"; //this.writeLine("o call " + cutsettings); //this.writeLine("F" + this.settings.feed); this.toolPosition = GCode.ToolPosition.Down; //this.writeLine(); this.toolIsDown(); }; /* // change M30 to M2 Plasma.prototype.writeFooter = function() { this.writeToolUp(); this.writeRapidZMove(this.getSafetyZLevel()); this.toolPosition = GCode.ToolPosition.Clear; this.writeLine("M2"); }; // get the nozzle type Plasma.prototype.getTorchNozzle = function() { //You can get the current layer as follows: var entity = this.getEntity(); var layerId = entity.getLayerId(); var layer = this.document.queryLayer(layerId); return layer.getCustomProperty("QCADCAM", "Cam/TorchNozzle", "manual"); }; // get the material thickness Plasma.prototype.getMaterialThickness = function() { //You can get the current layer as follows: var entity = this.getEntity(); var layerId = entity.getLayerId(); var layer = this.document.queryLayer(layerId); return layer.getCustomProperty("QCADCAM", "Cam/MaterialThickness", "manual"); }; GCode.prototype.prepareForCutting = function() { // force tool down before normal move: if (this.toolPosition !== GCode.ToolPosition.Down) { // force tool up before tool down: if (this.toolPosition !== GCode.ToolPosition.Up) { this.writeToolUp(); } this.writeToolDown(); } }; // probe for material top and fire the torch Plasma.prototype.writeToolDown = function() { this.g = GCode.Mode.Normal; this.z = this.getToolDownLevel(); this.torchNozzle = this.getTorchNozzle(); this.materialThickness = this.getMaterialThickness(); this.settings = this.getPlasmaInfo(this.torchNozzle,this.materialThickness); var cutsettings = "[" + this.settings.pierce + "]"; cutsettings += "[" + this.settings.delay + "]"; cutsettings += "[" + this.settings.cut + "]"; this.writeLine("o call " + cutsettings); this.writeLine("F" + this.settings.feed); this.toolPosition = GCode.ToolPosition.Down; //this.writeLine(); this.toolIsDown(); }; Plasma.prototype.writeToolUp = function() { this.g = GCode.Mode.Rapid; this.z = this.getToolUpLevel(); this.writeLine("M5"); this.toolPosition = GCode.ToolPosition.Up; if (this.feedRateSet!==true) { this.writeLine(undefined, "F200"); this.feedRateSet=true; } else { this.writeLine(); } this.toolIsUp(); }; */