Line Numbers (Solved)

Discussions around the CAM Add-On of QCAD version 3

Moderator: andrew

Line Numbers (Solved)

Postby 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

Postby 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

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

Re: Line Numbers (Solved)

Postby 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 "";
};
User avatar
andrew
Site Admin
 
Posts: 2618
Joined: Fri Mar 30, 2007 6:07 am

Re: Line Numbers (Solved)

Postby jthornton » Sun Oct 27, 2013 1:12 pm

Thanks
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

cron