Okuma Post Mods

Okuma Post Mods

gmdimarzio88
Collaborator Collaborator
2,253 Views
9 Replies
Message 1 of 10

Okuma Post Mods

gmdimarzio88
Collaborator
Collaborator

Fo those looking for a good Okuma post here's one I edited to have HA instead of H# values. G116 toolchanges, and table forward at the end of the program which I set to G30 P11. You can set that P value to anything besides P1. The Okuma guys told me to just avoid the first page of home positions so P1 doesn't accidentally get overwritten, so that's why it's P11. The G82 dwell time is also now functioning correctly. It could use some tweaking since I'm no expert, but it works well.

 

0 Likes
Accepted solutions (1)
2,254 Views
9 Replies
Replies (9)
Message 2 of 10

salesBY7V6
Participant
Participant

Hi,

 

Thanks for that, I have changed my post as in your attachment to move my table to the door G30P30 but it moves the table to the door after every operation rather than just at the end of the program.

 

Any help would be much appreciated.

 

error(localize("Bad axis specified for writeRetract()."));
return;
}
}

if (words) {
gMotionModal.reset();
if (properties.useG16) {
writeBlock(gFormat.format(16), hFormat.format(0), gMotionModal.format(0), words); // retract
} else {
writeBlock(gMotionModal.format, "G" + "30" + " P30");
}
}
zOutput.reset();
}

function onClose() {
writeln("");

onCommand(COMMAND_STOP_SPINDLE);
setCoolant(COOLANT_OFF);
onCommand(COMMAND_UNLOCK_MULTI_AXIS);

writeRetract(Z);

gAbsIncModal.reset();

if (machineConfiguration.isMultiAxisConfiguration()) {
setWorkPlane(new Vector(0, 0, 0)); // reset working plane
}

// writeRetract(X, Y);

forceXYZ();
gAbsIncModal.reset();

onCommand(COMMAND_END);
}

 

Thanks

0 Likes
Message 3 of 10

gmdimarzio88
Collaborator
Collaborator

I'm not sure how to only have it at the end. Whenever I tried to have this ONLY at the end, I get an error when posting. I'd love some help with this as well. I don't need the machine to go home between each work offset just at the end.

0 Likes
Message 4 of 10

bob.schultz
Alumni
Alumni

It looks like you added this code to the writeRetract function, which is called at the end of each operation.  You can move this code to the onClose function, which is only called at the end of the program.  Also the format of your code is not correct and should have generated an error.  See the correct format below.

function onClose() {
  writeln("");

  onCommand(COMMAND_STOP_SPINDLE);
  setCoolant(COOLANT_OFF);
  onCommand(COMMAND_UNLOCK_MULTI_AXIS);

  writeRetract(Z);
writeBlock(gFormat.format(30), "P30"); gAbsIncModal.reset();


Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 5 of 10

salesBY7V6
Participant
Participant
Accepted solution

That worked. Thank you very much.

0 Likes
Message 6 of 10

gmdimarzio88
Collaborator
Collaborator

Thank you. Finally got it working right.

0 Likes
Message 7 of 10

rslay_57cadcam
Explorer
Explorer

I have a question If I may I know this topic is a few versions back. The format that we use for the G116 macro is G116 PT=1 PQ=2 (PT is current tool PQ is preload)

we have them all on the same line so that the variables are passed through to the macro. 

 

I wrote the below code for the stock post and it works well as long as we don't try to use the same tool in multiple toolpaths. Once we try to use it in multiple toolpaths it gives an error that the nextTool is undefined.  This adds a check box incase someone doesn't want to use either the HA/DA or the G116 and will just do the default as well. Am i trying to make this overcomplicated or am I just missing why it thinks on repeat tool numbers it doesn't think the previous variable is undefined.

Thanks in advance

 

 

//user-defined properties

 useG116: {
    title      : "Enable G116 instead of M6",
    description: "Use G116 Macro instead of M6 for tool change",
    group      : "preferences",
    type       : "boolean",
    value      : false,
    scope      : "post"
  },
  useHADA: {
    title      : "Enable HA DA instead of Hxx Dxx",
    description: "Use HA and DA For Tool Len and Dia Offset",
    group      : "preferences",
    type       : "boolean",
    value      : false,
    scope      : "post"
  }


 // within the onSection function

if (getProperty("preloadTool")) {
      if ((!isLastSection()) && (getProperty("useG116"))) {
       
        forceSequenceNumbers(true);
        writeBlock("G0 G90 G30 P1", "(THIS IS THE RESTART LINE error out)");
        forceSequenceNumbers(false);
        var tNextTool = getNextTool(tool.number);
        var firstToolNumber = getSection(0).getTool().number
        if (tNextTool == firstToolNumber){
          writeBlock(gFormat.format(116), "PT=" + toolFormat.format(tool.number), "PQ=" + toolFormat.format(firstToolNumber));
        } else {
          writeBlock(gFormat.format(116), "PT=" + toolFormat.format(tool.number), "PQ=" + toolFormat.format(tNextTool.number));
        }
       
      }
      else
      if (getProperty('useG116')){
        forceUseG116(true);
       
      } else
      if (getProperty("safeToolChange")) {
        forceSequenceNumbers(true);
        writeBlock("G0 G90 G30 P1", "(THIS IS THE RESTART LINE Hi How are you )");
        writeBlock("IF [ VTLCN EQ " + toolFormat.format(tool.number) + " ] " + skipNLines(5));
        writeBlock("IF [ VTLNN EQ " + toolFormat.format(tool.number) + " ] " + skipNLines(3));
        writeBlock("IF [ VTLNN EQ 0 ] " + skipNLines(2));
        writeBlock(mFormat.format(64));
        writeBlock(mFormat.format(6),"T" + toolFormat.format(tool.number));
      } else {
        if (getProperty("useG116")) {
          if (!isFirstSection()){
            var firstToolNumber = getSection(0).getTool().number;
        forceSequenceNumbers(true);
        writeBlock("G0 G90 G30 P1", "(THIS IS THE RESTART LINE)");
        forceSequenceNumbers(false);
        var nextTool = getNextTool(tool.number);
        writeBlock(gFormat.format(116), "PT=" + toolFormat.format(tool.number), "PQ=" + toolFormat.format(firstToolNumber));
      }
    }
      else
        if (!isFirstSection()) {
         writeToolBlock(formatComment("T" + toolFormat.format(tool.number)));
         writeBlock(mFormat.format(6));
        } else {
         writeToolBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
        }
      }
      var nextTool = getNextTool(tool.number);
       if (nextTool) {
        if (getProperty("useG116")){
          writeBlock(formatComment("*"));
        } else
        writeBlock("T" + toolFormat.format(nextTool.number));
      } else {
        // preload first tool
        var firstToolNumber = getSection(0).getTool().number;
        if (getProperty("useG116")) {
          if (tool.number != firstToolNumber) {
          writeBlock(gFormat.format(116), "PT=" + toolFormat.format(tool.number), "PQ=" + toolFormat.format(firstToolNumber));
          } else
          writeBlock(formatComment("*"));

        }
        else
        if (tool.number != firstToolNumber) {
          writeBlock("T" + toolFormat.format(firstToolNumber));
        } else if (getProperty("safeToolChange")) {
          writeBlock(formatComment("*"));
        }
      }
    } else {
      if (getProperty("safeToolChange")) {
        forceSequenceNumbers(true);
        writeBlock("IF [ VTLCN EQ " + toolFormat.format(tool.number) + " ] " + skipNLines(2));
        writeBlock(mFormat.format(6), "T" + toolFormat.format(tool.number));
        writeBlock(formatComment("*"));
      } else {
        writeToolBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
      }
    }
    forceSequenceNumbers(false);
  }

 

 
 
 
0 Likes
Message 8 of 10

bob.schultz
Alumni
Alumni

I cannot duplicate this issue in Fusion with your post, but if you are getting an undefined nextTool variable, you can protect against this by using a command similar to the following.

 

  var nextTool = isLastSection() ? getSection(0).getTool().number : getNextTool(); // returns the first tool as the next tool when the last tool is loaded



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 9 of 10

rslay_57cadcam
Explorer
Explorer

I added that line and I still get the failed. Here is the error and what that section looks like in the output.

I am using the Post processor Benchmark v1 file to test. With these settings checked

rslay_57cadcam_0-1737503462064.png

 

###############################################################################
Error: tNextTool is undefined
Error at line: 1743 (okuma116-bob.cps)
Error in operation: '2D-Contour with compensation left'
Failed while processing onSection() for record 1423.
###############################################################################

Error: Failed to invoke function 'onSection'.
Error: Failed to invoke 'onSection' in the post configuration.
Error: Failed to execute configuration.
Stop time: Tuesday, January 21, 2025 11:46:36 PM
Post processing failed.


N2 G0 G90 G30 P1 (THIS IS THE RESTART LINE error out)
G116 PT=2 PQ=3
(*)
S6000 M03
G17 G90 G94
G15 H01
M08
G131 F39.37 J1. E0.0004
G00 X-2.0079 Y1.4437
G56 Z0.5906 HA
Z0.1969
G01 Z0.0394 F19.685
Z-0.4331
Y1.4398 F39.37
G03 X-1.8504 Y1.2823 I0.1575
G01 X1.5354
G02 X2.2665 Y0.5512 J-0.7311
G01 Y-0.8661
G02 X1.8504 Y-1.2822 I-0.4161
G01 X-1.6535 Y-1.2823
G02 X-2.2665 Y-0.6693 J0.613
G01 Y0.8661
G02 X-1.8504 Y1.2822 I0.4161
X-1.7634 Y1.2242 J-0.0943
G03 X-1.6762 Y1.166 I0.0872 J0.0363
G01 X1.5354 Y1.1661
G02 X2.1503 Y0.5512 J-0.6149
G01 X2.1504 Y-0.8661
G02 X1.8504 Y-1.1661 I-0.3
G01 X-1.6535
G02 X-2.1503 Y-0.6693 J0.4968
G01 X-2.1504 Y0.8661
G02 X-1.8504 Y1.1661 I0.3
G01 X-1.6762
G02 X-1.6387 Y1.1411 J-0.0406
G03 X-1.6012 Y1.1161 I0.0375 J0.0157
G01 X1.5354
G02 X2.1003 Y0.5512 J-0.5649
G01 X2.1004 Y-0.8661
G02 X1.8504 Y-1.1161 I-0.25
G01 X-1.6535
G02 X-2.1003 Y-0.6693 J0.4468
G01 X-2.1004 Y0.8661
G02 X-1.8504 Y1.1161 I0.25
G01 X-1.6012
G03 X-1.4437 Y1.2736 J0.1575
G01 Y1.2776
G00 Z0.5906
M05
G00 Z400.
G130

(2D-Contour with compensation left)
M09
G0 G90 G30 P1 (THIS MOVE IS FOR MAKING CERTAIN TOOL IS HOME AFTER WORK IS FINISHED)
M01
N3 G0 G90 G30 P1 (THIS IS THE RESTART LINE error out)
!Error: Failed to post data. See log for details.

Thanks for the help in narrowing this down.

0 Likes
Message 10 of 10

rslay_57cadcam
Explorer
Explorer

I fixed the issue it was a curly brace that was out of alignment.

 

Thanks for the assist again all

0 Likes