setEditText not working at expected

Discussions around the CAM Add-On of QCAD version 3

Moderator: andrew

setEditText not working at expected

Postby 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 41 times
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: setEditText not working at expected

Postby jthornton » Sun Nov 17, 2013 2:41 pm

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

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


Return to QCAD 3 CAM Add-On

Who is online

Users browsing this forum: No registered users and 0 guests