Multi Line Output

Multi Line Output

ericbUU8RW
Participant Participant
700 Views
1 Reply
Message 1 of 2

Multi Line Output

ericbUU8RW
Participant
Participant

The following code outputs tool information

 

 

 var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      for (var i = 0; i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = "T" + toolFormat.format(tool.number) + " " +
          "D=" + xyzFormat.format(tool.diameter) + " " +
          localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
        if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
          comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
        }
        if (zRanges[tool.number]) {
          comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum());
        }
        comment += " - " + getToolTypeName(tool.type);
        writeComment(comment);
      }
    }

 

Like this

 

(T1 D=2.5 CR=0.125 - BULLNOSE END MILL)
(T2 D=0.625 CR=0.125 - BULLNOSE END MILL)
(T5 D=0.5 CR=0.25 - BALL END MILL)
(T8 D=0.25 CR=0. - FLAT END MILL)
(T12 D=0.2656 CR=0. TAPER=118DEG - DRILL)
(T13 D=0.375 CR=0. TAPER=120DEG - SPOT DRILL)
(T15 D=0.75 CR=0. - FLAT END MILL)
(T16 D=0.375 CR=0. - FLAT END MILL)
(T17 D=0.06 CR=0.062 - RADIUS MILL)
(T22 D=0.269 CR=0. - REAMER)

 

How can I break up each tools information to its own line? Like this

 

(T1)
(D=2.5)
(CR=0.125)
(BULLNOSE END MILL)

 

How can I add a "new line" to each "comment"? 

0 Likes
701 Views
1 Reply
Reply (1)
Message 2 of 2

andrea.amilo
Community Manager
Community Manager

Hello @ericbUU8RW ,

 

you can replace the 'comment' variable with the 'writeComment' command, as shown here:

 

2022-11-14_11-50-44.png

 

 

I made this modification in the generic Fanuc post, but it should be the same for any other post.

Please test it carefully and let me know.

 



Andrea Amilo

Senior Technical Consultant

Autodesk Knowledge Network | Fusion 360 Webinars | Autodesk Make
0 Likes