Tool List Header Comments - Multiple Offsets Same Tool Number?

Tool List Header Comments - Multiple Offsets Same Tool Number?

jonathanBUCVS
Advocate Advocate
2,679 Views
13 Replies
Message 1 of 14

Tool List Header Comments - Multiple Offsets Same Tool Number?

jonathanBUCVS
Advocate
Advocate

Currently, if I have T0101 and T0111 both used in the same posted code, the header will overwrite with the last tool so something like:

(T0101 - CNMG432)

(T0111 - CNMG432)

(T0202 - VNMG 331)

 

would just be:

(T0111 - CNMG432)

(T0202 - VNMG 331)

 

I am trying to think of a way to adjust the post so that it allows "duplicate" tool numbers when the offset is different. Any thoughts? I can post the post code section if needed, but its the stock one.

0 Likes
Accepted solutions (1)
2,680 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable

No need to edit post, just use post processor tab in tool definition.

 

2021-05-13 20_13_33-Tool Library.png2021-05-13 20_16_31-Tool Library.png

0 Likes
Message 3 of 14

jonathanBUCVS
Advocate
Advocate

I understand how to change the offset for the tool. When the entire program posts, the top of the program is a header that contains the tool list as comments. This is the part that is overwritten if there are tools with the same T number but different offsets.

0 Likes
Message 4 of 14

Anonymous
Not applicable

Ah I see, I overlooked the real issue, so I tested small file with T0404 and T0414, results in only T0404 in program hedder but T0414 is in second operation as expected, I tested 4 different posts, same result.

Good enough for me but if you wanna show both, then yes, post will need to be edited.

0 Likes
Message 5 of 14

boopathi.sivakumar
Autodesk
Autodesk

Hi @jonathanBUCVS 

I think it has to be fixed in the getToolTable() function.. i will create a ticket for this.

for time being you can use this modification in the post to get

add this supporting function

// Add form here
function isToolChange(pTool, cTool) {
  if ((pTool.number == cTool.number) && (cTool.diameter != 0 ? (pTool.diameter == cTool.diameter) : true) &&
    (pTool.compensationOffset == cTool.compensationOffset) &&
    (pTool.lengthOffset == cTool.lengthOffset) &&
    (cTool.isTurningTool() ? (pTool.noseRadius == cTool.noseRadius) : true) &&
    (cTool.description == pTool.description)) {
    return false;
  } else {
    return true;
  }
}
// to here
function onComment(message) {
  writeComment(message);
}

and change the entire code block form if (getProperty("writeTools"))   to the following codes

 // Replace this codes form
  if (getProperty("writeTools")) {
    var zRanges = {};
    if (is3D()) {
      var numberOfSections = getNumberOfSections();
      for (var i = 0; i < numberOfSections; ++i) {
        var section = getSection(i);
        var zRange = section.getGlobalZRange();
        var tool = section.getTool();
        if (zRanges[tool.number]) {
          zRanges[tool.number].expandToRange(zRange);
        } else {
          zRanges[tool.number] = zRange;
        }
      }
    }
    var previousTool;
    for (var i = 0; i < numberOfSections; ++i) {
      var tool = getSection(i).getTool();
      if (i == 0) {
        previousTool = tool;
      }
      if ((i == 0) || isToolChange(previousTool, tool)) {
        var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
        var comment = "T" + toolFormat.format(tool.number * 100 + compensationOffset % 100) + " " +
        (tool.diameter != 0 ? "D=" + spatialFormat.format(tool.diameter) + " " : "") +
        (tool.isTurningTool() ? localize("NR") + "=" + spatialFormat.format(tool.noseRadius) : localize("CR") + "=" + spatialFormat.format(tool.cornerRadius)) +
        (tool.taperAngle > 0 && (tool.taperAngle < Math.PI) ? " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg") : "") +
        (zRanges[tool.number] ? " - " + localize("ZMIN") + "=" + spatialFormat.format(zRanges[tool.number].getMinimum()) : "") +
          " - " + localize(getToolTypeName(tool.type));
        writeComment(comment);
      }
      previousTool = tool;
    }
  }
  // <<<<<<<to here 

  // absolute coordinates and feed per min
  writeBlock(conditional(getProperty("type") != "A", gAbsIncModal.format(90)), formatFeedMode(FEED_PER_MINUTE), gPlaneModal.format(18));

save the post and test 


Boopathi Sivakumar
Principal Technology Consultant

Message 6 of 14

jonathanBUCVS
Advocate
Advocate

@boopathi.sivakumar 

I have copied and pasted the isToolChange function above the "onComment" function, and overwritten the writeTools function. Unfortunately the tool list is not displaying at all.

The value is Yes for parameter "Write tool list" on the Post Process window. I tried a few different part files and a few versions of the post.

0 Likes
Message 7 of 14

boopathi.sivakumar
Autodesk
Autodesk

Could you attach the modified post here.. You might need to zip the file before attaching here

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 8 of 14

jonathanBUCVS
Advocate
Advocate

@boopathi.sivakumar  files attached.

 

added provided code at lines 958-968 and 830-863

0 Likes
Message 9 of 14

boopathi.sivakumar
Autodesk
Autodesk

@jonathanBUCVS  Ahh.. its with property definition 

need to change this line 

  // dump tool information
  if (getProperty("writeTools")) {

with this

  // dump tool information
  if (properties.writeTools) {

Hope this time it should work fine

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 10 of 14

jonathanBUCVS
Advocate
Advocate

@boopathi.sivakumar That did work, Thank you.


Let me know if you can think of a simple solution for the following two things:

1. Can we revert to the tools being in numerical order? (instead of in order of use) Im ok with either the tool number or the offset number used to index the list, ie T0101, T0111, T0202, T0222, or T0101, T0202, T0111, T0222

2. If a tool is called twice, it is duplicated in the list (see T1313, where it does a deburring pass after the threading tool)
Here is an example I just posted:

(T0101 NR=0.0156 - ZMIN=0. - GENERAL TURNING)
(T1313 NR=0.0156 - ZMIN=-0.6656 - GENERAL TURNING)
(T0505 NR=0. - ZMIN=0.2069 - THREAD TURNING)
(T1313 NR=0.0156 - ZMIN=-0.6656 - GENERAL TURNING)
(T0303 D=0.5 CR=0. - ZMIN=-0.248 - FLAT END MILL)
(T0606 D=0.1015 CR=0. TAPER=118DEG - ZMIN=-0.4519 - DRILL)
(T0707 D=0.125 CR=0. TAPER=90DEG - ZMIN=-0.29 - SPOT DRILL)
(T0808 D=0.112 CR=0. - ZMIN=-0.4114 - RIGHT HAND TAP)
(T0909 D=0.1875 CR=0. - ZMIN=-0.334 - FLAT END MILL)
(T0707 D=0.125 CR=0. TAPER=90DEG - ZMIN=-0.29 - SPOT DRILL)
(T1111 NR=0.0156 - ZMIN=-0.25 - BORING TURNING)
(T1212 NR=0.008 - ZMIN=-0.7557 - GROOVE TURNING)
((This is the sub spindle tooling))
(T0232 NR=0.0156 - ZMIN=0. - GENERAL TURNING)
(T0737 D=0.25 CR=0. - ZMIN=-0.29 - FLAT END MILL)
(T1646 D=0.5 CR=0. TAPER=45DEG - ZMIN=-0.202 - CHAMFER MILL)
(T0434 D=0.395 CR=0. - ZMIN=-0.226 - RIGHT HAND TAP)

 

0 Likes
Message 11 of 14

boopathi.sivakumar
Autodesk
Autodesk
Accepted solution

@jonathanBUCVS Change the tool Comment logic like the below

    }
    var toolList = []; // add this line
    var previousTool;
    for (var i = 0; i < numberOfSections; ++i) {
      var tool = getSection(i).getTool();
      if (i == 0) {
        previousTool = tool;
      }
      if ((i == 0) || isToolChange(previousTool, tool)) {
        var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
        var comment = "T" + toolFormat.format(tool.number * 100 + compensationOffset % 100) + " " +
        (tool.diameter != 0 ? "D=" + spatialFormat.format(tool.diameter) + " " : "") +
        (tool.isTurningTool() ? localize("NR") + "=" + spatialFormat.format(tool.noseRadius) : localize("CR") + "=" + spatialFormat.format(tool.cornerRadius)) +
        (tool.taperAngle > 0 && (tool.taperAngle < Math.PI) ? " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg") : "") +
        (zRanges[tool.number] ? " - " + localize("ZMIN") + "=" + spatialFormat.format(zRanges[tool.number].getMinimum()) : "") +
          " - " + localize(getToolTypeName(tool.type));
        toolList.push(comment);  // Change this line
      }
      previousTool = tool;
    }
  }
//add codes form here
  toolList.sort();
  for (var i = 0; i < toolList.length; ++i) {
    if (i == 0 || toolList[i] != [toolList[i-1]]){
      writeComment(toolList[i]);
    }
  }
// to here

  if (false) {
    // check for duplicate tool number

 Check and let me know the feedback


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 12 of 14

jonathanBUCVS
Advocate
Advocate

@boopathi.sivakumar   Yes, this works great, thank you! I tested it on a few files and it is exactly what I was looking for. 

I am going to try to apply some of this new knowledge to the Excel tool sheet post, as that one also used the getToolTable() function, which I guess doesnt allow duplicate tool numbers with different offsets. 

0 Likes
Message 13 of 14

jason61
Enthusiast
Enthusiast

I've edited my NLX Post with this and it works great but i'd love to be able to add the Tool Description to the beginning of the post as well?  Ideally i'd love to see it spit out something like this:

 

(T0101 -- ISCAR PCLNR16-4JHP, CNMG432 INSERT)

(NR=0.0312 - ZMIN=1.05 - GENERAL TURNING)

(T0102 -- ISCAR SVJCR16-3-JHP, VCGT333 INSERT)

NR=0.0469 - ZMIN=1.05 - GENERAL TURNING)

(T0303 -- ISCAR MAHPR 25.4, 3MM INSERT)

(NR=0.012 - ZMIN=3.2135 - GROOVE TURNING)

These tool lists at the top of the program need to give the operator as much useful information as possible.

 

Thanks,

Jason

PRL Motorsports

0 Likes
Message 14 of 14

simon7BJNH
Explorer
Explorer

Is it possible to get this to work when i use tool 0?

like T0060

0 Likes