Line Numbers (Solved)

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

Line Numbers (Solved)

Post by jthornton » Sat Oct 26, 2013 3:05 pm

Is it possible to turn off line numbering? This is not needed with LinuxCNC.

Thanks
JT
Last edited by jthornton on Sat Oct 26, 2013 3:24 pm, edited 1 time in total.

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

Re: Line Numbers

Post by jthornton » Sat Oct 26, 2013 3:16 pm

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

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

Re: Line Numbers

Post by jthornton » Sat Oct 26, 2013 3:22 pm

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

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Line Numbers (Solved)

Post by andrew » Sat Oct 26, 2013 4:51 pm

OK, great. Just for future reference: the preferred way to disable line numbers would be:
Lcnc_Mill.prototype.getLineNumberCode = function() {
    return "";
};

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

Re: Line Numbers (Solved)

Post by jthornton » Sun Oct 27, 2013 1:12 pm

Thanks
JT

Evan
Newbie Member
Posts: 8
Joined: Tue Jan 04, 2022 5:24 pm
Location: South-East of France

Re: Line Numbers (Solved)

Post by Evan » Thu Oct 27, 2022 9:08 pm

Just undefine lineNumber in your constructor
this.lineNumber = undefined; // No line numbers
My dream: to see QCAD integrated to FREECAD in place of SKETCHER

Post Reply

Return to “QCAD/CAM”