Fanuc Oi Mate-MC, WCS need change post processor to code G54 on first rapid move

Fanuc Oi Mate-MC, WCS need change post processor to code G54 on first rapid move

Anonymous
Not applicable
1,366 Views
7 Replies
Message 1 of 8

Fanuc Oi Mate-MC, WCS need change post processor to code G54 on first rapid move

Anonymous
Not applicable

Machine: Sharp 2412

Year: 2007

Control: Fanuc Oi Mate-MC

Post to modify: Fanuc 

 

I am having a problem with getting the post to insert the WCS G54 on the initial G0 rapid move. Our machine does not see the G54 if it is on a line by itself for some reason.

What I would like to do is have the WCS G54 program on the first initial rapid movement only at the start of the tool and at each tool change. Can I get some help please?

 

Here is how it posts with no modification. As you can see G54 is on a single line alone, line 13, and the machine does not recognize it:

0 Likes
Accepted solutions (2)
1,367 Views
7 Replies
Replies (7)
Message 2 of 8

bob.schultz
Alumni
Alumni
Accepted solution

This is easily done in the post.  You will need to change the output of the WCS block to storing it in a buffer that will be output later.  First, you need to define the buffer in the onSection function.

 

  // wcs
  if (insertToolCall) { // force work offset when changing tool
  currentWorkOffset = undefined;
  }
  var workOffset = currentSection.workOffset;
  var wcsCode = "";

 

Next you will store the WCS codes in this buffer.

 

  if (workOffset > 0) {
    if (workOffset > 6) {
      var p = workOffset - 6; // 1->...
      if (p > 300) {
        error(localize("Work offset out of range."));
        return;
      } else {
      if (workOffset != currentWorkOffset) {
        wcsCode = formatWords(gFormat.format(54.1), "P" + p); // G54.1P
        currentWorkOffset = workOffset;
      }
    }
  } else {
    if (workOffset != currentWorkOffset) {
      wcsCode = formatWords(gFormat.format(53 + workOffset)); // G54->G59
      currentWorkOffset = workOffset;
    }
  }
}

 

Now output the WCS buffer with the initial move.

 

  writeBlock(
    wcsCode,
    gAbsIncModal.format(90),
    gMotionModal.format(0), xOutput.format(initialPosition.x), yOutput.format(initialPosition.y)
  );



Bob Schultz
Sr. Post Processor Developer

Message 3 of 8

Anonymous
Not applicable

Thank You Bob, this worked. I changed it up a little so the G54 would come after the G0 on the same line by doing this:

if (!machineConfiguration.isHeadConfiguration()) {
writeBlock(
gAbsIncModal.format(90),
gMotionModal.format(0), wcsCode, xOutput.format(initialPosition.x), yOutput.format(initialPosition.y)

Codes like this:

G00 G54 X7.7187 Y-5.5265

 

Is there a way to also force the G90 to be added to this line as well after the G54 callout?

So it codes something like this:

G00 G54 G90 X7.7187 Y-5.5265

0 Likes
Message 4 of 8

bob.schultz
Alumni
Alumni
Accepted solution

Yes, you can force out the G90 code on the block by issuing the following command before the writeBlock.  Of course, you already know how to move the G90 code within the block🙂

 

gAbsIncModal.reset();

writeBlock(
gAbsIncModal.format(90),
gMotionModal.format(0), wcsCode, xOutput.format(initialPosition.x), yOutput.format(initialPosition.y)

 

 



Bob Schultz
Sr. Post Processor Developer

Message 5 of 8

Anonymous
Not applicable

Thank you again Bob. I really appreciate it.

How about this one, I want to change at the end of the program before the M30 to move the table from the G28 machine reference zero position (which is the back right corner of the table) to code out a move to park the table in the middle of the door rather than all the way to the left.

Currently Codes this at the end:

G18 G02 X6.425 Z-0.45 I0. K0.05
G00 Z0.6
G17

M09
G28 G91 Z0.
G90    (not sure why this is here?)
G49
G28 G91 X0. Y0.
G90    (not sure why this is here?)
M30
%

 

Want it to code something like this at the end to park the table at the center of door:

G18 G02 X6.425 Z-0.45 I0. K0.05
G00 Z0.6
G17

M09
G28 G91 Z0.
G90    (not sure why this is here?) (I would like to remove this here only unless it needs to be there)
G49
G28 G91 X0. Y0.   (I would like this to be G28 G91 X-12.0 Y0)
G90    (not sure why this is here?) (I would like to remove this here only unless it needs to be there)
M30
%

 

Thank you again for the help.

0 Likes
Message 6 of 8

bob.schultz
Alumni
Alumni

For safety reasons, the post processor outputs the G90 code after each G91 G28 block to reset absolute mode.  These codes are output in the writeRetract function.

 

If you take a look at the Haas post processor you will see that it has the property 'Home position center' that will center the part in front of the door at the end of the program.  You can "borrow" this code from the Haas post and place it in your post.  

 

// define home positions
  var _xHome;
  var _yHome;
  var _zHome;
  if (_useG28) {
    _xHome = 0;
    _yHome = 0;
    _zHome = 0;
  } else {
    if (properties.homePositionCenter &&
      hasParameter("part-upper-x") && hasParameter("part-lower-x")) {
      _xHome = (getParameter("part-upper-x") + getParameter("part-lower-x")) / 2;
    } else {
      _xHome = machineConfiguration.hasHomePositionX() ? machineConfiguration.getHomePositionX() : 0;
    }
    _yHome = machineConfiguration.hasHomePositionY() ? machineConfiguration.getHomePositionY() : 0;
    _zHome = machineConfiguration.getRetractPlane();
  }
  for (var i = 0; i < arguments.length; ++i) {
    // define the axes to move
    switch (arguments[i]) {
    case X:
      // special conditions
      if (properties.homePositionCenter) { // output X in standard block by itself if centering
        writeBlock(gMotionModal.format(0), xOutput.format(_xHome));
        _xyzMoved[0] = false;
        break;
      }
      words.push("X" + xyzFormat.format(_xHome));
      break;

You will not be able to just cut and paste the code into your post, but it should be fairly easy for you to merge the 'homePositionCenter' portion of the code into your post.



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 7 of 8

Anonymous
Not applicable

Bob,

  This one might be over my head as I haven't made it come out right yet. Is there a way to just force a text line of code in at the end? So it comes out like this:

G00 Z0.6

M09
G28 G91 Z0.
G90
G49
G28 G91 X0. Y0.

G00 X-12.0
G90
M30
%

 

I know the machine will first go to the machine home coordinates and then do an incremental move from there back to the center of the door.

0 Likes
Message 8 of 8

bob.schultz
Alumni
Alumni

It is quite easy to add a fixed line to your output.  Since you do not want to cancel G91 after the move to the home position, you can make the following changes in the onClose function to output the blocks as you desire.

  // writeRetract(X, Y)
  writeBlock(gFormat.format(28), gAbsIncModal.format(91), "X0", "Y0");
  writeBlock(gFormat.format(0), "X" + xFormat.format(-12.0));
  writeBlock(gAbsIncModal.format(90));

 



Bob Schultz
Sr. Post Processor Developer

0 Likes