Page 1 of 1

Line Numbers (Solved)

Posted: Sat Oct 26, 2013 3:05 pm
by jthornton
Is it possible to turn off line numbering? This is not needed with LinuxCNC.

Thanks
JT

Re: Line Numbers

Posted: Sat Oct 26, 2013 3:16 pm
by jthornton
I've managed to turn off line numbers for all the lines except the header and footer with:

Code: Select all

Lcnc_Mill.prototype.writeLine = function(custom, append) {
    var line = "";

    if (!isNull(custom)) {
        line = this.getLineNumberCode();
        line = this.append(line, custom);
        CamExporter.prototype.writeLine.call(this, line);
        return;
    }

    var gotModeChange = this.gotModeChange(this.g);
    var gotXMove = this.gotXMove(this.x);
    var gotYMove = this.gotYMove(this.y);
    var gotZMove = this.gotZMove(this.z);
    var gotFeedrateChange = this.gotFeedrateChange(this.f);

    // nothing to do:
    if (this.g!==GCode.Mode.CircularCW && this.g!==GCode.Mode.CircularCCW &&
        !gotXMove && !gotYMove && !gotZMove && !gotFeedrateChange) {
        return;
    }

//    line = this.getLineNumberCode();

    switch (this.g) {
    case GCode.Mode.Rapid:
        if (gotModeChange) {
            line = this.append(line, this.getRapidMoveCode());
        }
        break;
    case GCode.Mode.Normal:
        if (gotModeChange) {
            line = this.append(line, this.getLinearMoveCode());
        }
        break;
    case GCode.Mode.CircularCW:
        line = this.append(line, this.getCircularCWMoveCode());
        break;
    case GCode.Mode.CircularCCW:
        line = this.append(line, this.getCircularCCWMoveCode());
        break;
    }
I'll keep looking for the other one...

JT

Re: Line Numbers

Posted: Sat Oct 26, 2013 3:22 pm
by jthornton
Ok, I got that figured out with this:

Code: Select all

Lcnc_Mill.prototype.writeLine = function(custom, append) {
    var line = "";

    if (!isNull(custom)) {
//        line = this.getLineNumberCode();
        line = this.append(line, custom);
        CamExporter.prototype.writeLine.call(this, line);
        return;
    }

    var gotModeChange = this.gotModeChange(this.g);
    var gotXMove = this.gotXMove(this.x);
    var gotYMove = this.gotYMove(this.y);
    var gotZMove = this.gotZMove(this.z);
    var gotFeedrateChange = this.gotFeedrateChange(this.f);

    // nothing to do:
    if (this.g!==GCode.Mode.CircularCW && this.g!==GCode.Mode.CircularCCW &&
        !gotXMove && !gotYMove && !gotZMove && !gotFeedrateChange) {
        return;
    }

//    line = this.getLineNumberCode();

    switch (this.g) {
    case GCode.Mode.Rapid:
        if (gotModeChange) {
            line = this.append(line, this.getRapidMoveCode());
        }
        break;
    case GCode.Mode.Normal:
        if (gotModeChange) {
            line = this.append(line, this.getLinearMoveCode());
        }
        break;
    case GCode.Mode.CircularCW:
        line = this.append(line, this.getCircularCWMoveCode());
        break;
    case GCode.Mode.CircularCCW:
        line = this.append(line, this.getCircularCCWMoveCode());
        break;
    }

    if (gotXMove || this.g===GCode.Mode.CircularCW || this.g===GCode.Mode.CircularCCW) {
        line = this.append(line, this.getXCode(this.x));
    }

    if (gotYMove || this.g===GCode.Mode.CircularCW || this.g===GCode.Mode.CircularCCW) {
        line = this.append(line, this.getYCode(this.y));
    }

    if (gotZMove) {
        line = this.append(line, this.getZCode(this.z));
    }

    if (gotFeedrateChange) {
        line = this.append(line, this.getFCode(this.f));
    }

    if (this.g===GCode.Mode.CircularCW || this.g===GCode.Mode.CircularCCW) {
        line = this.append(line, this.getICode(this.i));
        line = this.append(line, this.getJCode(this.j));
    }

    if (!isNull(append)) {
        line = this.append(line, append);
    }

    CamExporter.prototype.writeLine.call(this, line);

    //this.lineNumber += 10;
    this.xPrev = this.x;
    this.yPrev = this.y;
    this.zPrev = this.z;
    this.fPrev = this.f;
    this.gPrev = this.g;
};
Thanks
JT

Re: Line Numbers (Solved)

Posted: Sat Oct 26, 2013 4:51 pm
by andrew
OK, great. Just for future reference: the preferred way to disable line numbers would be:
Lcnc_Mill.prototype.getLineNumberCode = function() {
    return "";
};

Re: Line Numbers (Solved)

Posted: Sun Oct 27, 2013 1:12 pm
by jthornton
Thanks
JT

Re: Line Numbers (Solved)

Posted: Thu Oct 27, 2022 9:08 pm
by Evan
Just undefine lineNumber in your constructor
this.lineNumber = undefined; // No line numbers