setEditText not working at expected

Discussions around the CAM Add-On of QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Indicate the post processor used.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
jthornton
Full Member
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

setEditText not working at expected

Post by jthornton » Sat Nov 16, 2013 7:50 pm

I have the following code and if I accecpt the defaults when I generate the G code the functions to get the value returns the first one from each combo box not the one displayed. If I select any thing in any box they all get updated. Am I missing something to update the values?

Code: Select all

// set up Layer Options for Plasma
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.5");
        break;
    case "CutHeight":
        w.addItems(["0.125", "0.150", "0.175"]);
        w.setEditText("0.125");
        break;
    case "TorchNozzle":
        w.addItems(["manual", "FC", "40a", "60a", "80a"]);
        w.setEditText("FC");
        break;
    case "MaterialThickness":
        w.addItems(["manual", "16ga", "14ga", "12ga", "11ga", "3/16", "1/4", "3/8"]);
        w.setEditText("11ga");
        break;
    }
};

// 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");
};


Plasma.prototype.writeToolDown = function() {
    this.g = GCode.Mode.Normal;
    this.z = this.getToolDownLevel();
    this.torchNozzle = this.getTorchNozzle();
    this.materialThickness = this.getMaterialThickness();
    switch (this.torchNozzle)
    {
    case "manual":
        qDebug("Manual");
        break;
    case "FC":
        qDebug("Fine cut");
        break;
    case "40a":
        qDebug("40 amp");
        break;
    case "60a":
        qDebug("60 amp");
        break;
    case "80a":
        qDebug("80 amp");
        break;
    default:
        qDebug("No Match");
    }
    qDebug("torch " + this.torchNozzle);
    qDebug("thickness " + this.materialThickness);
    this.toolPosition = GCode.ToolPosition.Down;
    this.writeLine();
    this.toolIsDown();
};
Thanks
JT
Attachments
Plasma.zip
(2.12 KiB) Downloaded 575 times

jthornton
Full Member
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: setEditText not working at expected

Post by jthornton » Sun Nov 17, 2013 2:41 pm

I found the problem the QComboBox property editable needed to be checked.

JT

Post Reply

Return to “QCAD/CAM”