Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Okuma Turning: including the turret station (compensationOffset) in the tool description

2 REPLIES 2
Reply
Message 1 of 3
Fully_Defined
102 Views, 2 Replies

Okuma Turning: including the turret station (compensationOffset) in the tool description

 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) + " " +
          (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);
      }
    }
 
This section is for the header that lists the tools at the top of the program, directly beneath the machine description. It has to be toggled on when posting.
 
I would like for the turret station (compensationOffset) to be directly before the tool number, but there are a couple of issues with this:
 
1) Drills don't have turret stations (they have length offsets)
2) When I added it where I wanted it, it just posted zeroes.
 
I changed this line: var comment = "T" + toolFormat.format(tool.number) + " " +
 
to this: var comment = (compensationOffset) + " " + "T" + toolFormat.format(tool.number) + " " +
 
But it just looked like this:
 
(0 T2002 NR=0.8 - ZMIN=-50.6 - BORING TURNING)
(0 T7001 D=25.4 CR=0. - ZMIN=-50.75 - DRILL)
 
It should look like this:
 
(9 T2002 NR=0.8 - ZMIN=-50.6 - BORING TURNING)
(7 T7001 D=25.4 CR=0. - ZMIN=-50.75 - DRILL)
 
I would also be okay with this:
 
(9) (T2002 NR=0.8 - ZMIN=-50.6 - BORING TURNING)
(7) (T7001 D=25.4 CR=0. - ZMIN=-50.75 - DRILL)
 
How can I change this to post the desired result?
 
Does it have to be conditional, in order to catch drill length offsets too?
2 REPLIES 2
Message 2 of 3

I changed it to this:

 

 var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      for (var i = 0; i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = (tool.compensationOffset) + " " + "T" + toolFormat.format(tool.number) + " " +
          (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);
      }
    }
 
And now it gives me this:
 
(9 T2002 NR=0.8 - ZMIN=-50.6 - BORING TURNING)
(0 T7001 D=25.4 CR=0. - ZMIN=-50.75 - DRILL)
 
Which is better, but...
 
T7001 is a drill, and not a turning tool, so it returns a value of zero. Later in the PP, I encounter the following code:
 
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
    if (compensationOffset > 99) {
      error(localize("Compensation offset is out of range."));
      return;
    }

    writeBlock("T" + toolFormat.format(compensationOffset) + toolFormat.format(compensationOffset) + toolFormat.format(compensationOffset));
    if (tool.comment) {
      writeComment(tool.comment);
    }
 
I changed the second of the two tool calls to call for the turret position, rather than the tool number. The previous machinist(s) had been naming every tool 1-12 to get around this, but it wasn't hard to fix. Now I get "T070707" in a tool call instead of "T0770017001", since I started changing tool numbers to 1-9999 instead of 1-12.
 
But I digress. The whole point is that the var=compensationOffset is all the way down at a tool call, and I need to call it way up higher in the PP so I can include the turret numbers in the tool list at the top of the program. This part of the code lets me use compensationOffset to mean turret position, which is what I want to put in the tool list.
 
I don't know Javascript well enough to wedge it in there. Can it be in a PP twice?
Message 3 of 3

I solved it.

 

var tools = getToolTable();
    if (tools.getNumberOfTools() > 0) {
      for (var i = 0; i < tools.getNumberOfTools(); ++i) {
        var tool = tools.getTool(i);
        var comment = toolFormat.format(tool.compensationOffset || tool.lengthOffset) + " " + "T" + toolFormat.format(tool.number) + " " +
          (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);
      }
    }
 
I also changed the tool call so I get T070707 instead of T0770017001:
 
var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset;
    if (compensationOffset > 16) { //DML20230314
      error(localize("Compensation offset is out of range."));
      return;
    }
 
writeBlock("T" + toolFormat.format(compensationOffset) + toolFormat.format(compensationOffset) + toolFormat.format(compensationOffset));
    if (tool.comment) {
      writeComment(tool.comment);
    }
 
Now the heading looks mostly right, except the tool description:
 

(2914_DML_202303141505.MIN)
(OKUMA L250II-E)
(01 T1001 NR=0.4 - ZMIN=6.601 - GENERAL TURNING)
(09 T2001 NR=0.4 - ZMIN=5.7 - BORING TURNING)
N10 G50 S2000
N11 G0 X9999.
N12 G0 Z9999.

(TURNING FACE1)
N13 T010101
(HTTPSWWW.SANDVIK.COROMANT.COMEN-USPRODUCT-DETAILSC=DCGT201120T32004-UM20202020S205)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report