How To Add Line Numbers at Tool Changes?

How To Add Line Numbers at Tool Changes?

utekcnc
Advocate Advocate
2,375 Views
10 Replies
Message 1 of 11

How To Add Line Numbers at Tool Changes?

utekcnc
Advocate
Advocate

On our other CAM system it's puts a line number at every tool change.   We don't use numbers except for that.   For example right before a M6T2 it will place N2000.    We use these for restarting.   I'm using the generic Fanuc post.  Is there anyway to do this?  Or can I add the code before I post process with Manual NC?   I can't seem to get it to work any which way.   Thank you.

0 Likes
Accepted solutions (1)
2,376 Views
10 Replies
Replies (10)
Message 2 of 11

randyT9V9C
Collaborator
Collaborator

I implemented this in one of my posts using a couple user parameters in my post processor. Looking at the code tonight it could be done without the numberOperations switch and simply turn it on if showSequenceNumbers == false. Maybe this will get you pointed in the right direction.

 

  if (hasParameter("operation-comment")) {
    var comment = getParameter("operation-comment");
    if (comment && properties.numberOperations && properties.showSequenceNumbers == false) {
      writeWords2("N" + (sequenceNumber % 10000), ";(" + comment +")");
      sequenceNumber += properties.sequenceNumberIncrement;
    } else if (comment) {
        writeComment(comment);
        }
    }
Message 3 of 11

utekcnc
Advocate
Advocate

Ok, I'll take a look.  I've never messed with things inside the post, so hope I don't mess something up.

0 Likes
Message 4 of 11

engineguy
Mentor
Mentor

@utekcnc

 

Make sure you make a copy of your Post and save it somewhere on your computer before making any alterations, that way you can easily paste it back into your Post library and be back to where you started from 🙂

 

Regards

Rob

0 Likes
Message 5 of 11

utekcnc
Advocate
Advocate

Well, I looked at that and couldn't make heads or tails of it.   I'll have to study it sometime I guess.

 

0 Likes
Message 6 of 11

randyT9V9C
Collaborator
Collaborator

Which Fanuc post are you using?

0 Likes
Message 7 of 11

utekcnc
Advocate
Advocate
FANUC/fanuc
0 Likes
Message 8 of 11

randyT9V9C
Collaborator
Collaborator

Copy the Fanuc post to your personal/local posts folder and change line 1117 to this:

    if (!properties.showSequenceNumbers) {
      writeBlock("N" + (sequenceNumber % 10000), "T" + toolFormat.format(tool.number), mFormat.format(6));
      sequenceNumber += properties.sequenceNumberIncrement;
    } else {
        writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
    }

 

This will only number the tool changes when you turn off sequence numbers. You can also change line 44 to showSequenceNumbers: false so your newly modified post will default to your desired behavior.

 

See the attached modified Fanuc post.

 

Message 9 of 11

utekcnc
Advocate
Advocate

Thank you,  I will take a look in a day or two and see if I can do this per your instructions.

0 Likes
Message 10 of 11

utekcnc
Advocate
Advocate

This worked in the part that it adds numbers at each tool change.   Is there a way however that the N number would match the tool number?   For example, If I'm using tool 9 it would say N9 or N9000?

 

0 Likes
Message 11 of 11

randyT9V9C
Collaborator
Collaborator
Accepted solution

Change the statement to use tool.number for your block number on the if statement starting on line 1117:

    if (!properties.showSequenceNumbers) {
      writeBlock("N" + (tool.number), "T" + toolFormat.format(tool.number), mFormat.format(6));
    } else {
        writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
    }
0 Likes