Grbl Code error

Grbl Code error

prdurand
Participant Participant
2,143 Views
12 Replies
Message 1 of 13

Grbl Code error

prdurand
Participant
Participant

When post processing code with the grbl post, it gives an error on the controller that reads: "Invalid gcode ID:36"

The line where is occurs is below:

Last error

N24X6.497Y0.54I-0.05J0

There are unused, leftover G code words that aren't used by any command in the block.

 

-This is has started occurring after the recent update.

I have attached the code and post processor, I would like for someone to make the necessary adjustments to overcome this error.

0 Likes
2,144 Views
12 Replies
Replies (12)
Message 2 of 13

boopathi.sivakumar
Autodesk
Autodesk

Could you reattach the files here, I cannot able to see the attached files

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 3 of 13

prdurand
Participant
Participant

Just found how to attach files....

Let me know quickly if you have the files.

I am unable to do any work with my cnc using Fusion 360...

 

0 Likes
Message 4 of 13

boopathi.sivakumar
Autodesk
Autodesk

It seems like the controller does  not like the round-off error on the final point of the circle.
the case is already discussed in the below thread 

https://forums.autodesk.com/t5/hsm-post-processor-forum/error-in-end-point-of-circle-siemens-840d/m-...

Already Prototrak  Post is has this functionality you can copy paste the codes as mentioned in the thread.

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 5 of 13

prdurand
Participant
Participant

Is that the level of support we get with a paid license?

I now have to become a Fusion 360 programmer.

 

so you know that I have been using this cnc router with Fusion 360 for many years now, without this problem.

this problem arose after the last updates. You broke it, is it to much to ask to provide a paying customer for a easy fix?

 Very disappointing. 

0 Likes
Message 6 of 13

boopathi.sivakumar
Autodesk
Autodesk

Nothing has been changed to cause this error with the last update.. I am guessing this could be the issue with the error code you mentioned.

also you could try linearize the circular moves to resolve the issue but it increases the file size and length if that doesn't bother change this line to

allowedCircularPlanes = undefined; // allow any circular motion

 this

allowedCircularPlanes = 0; 

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 7 of 13

prdurand
Participant
Participant

the grbl.cps post processor file has never been modified. It is the one provided and copywrited by Autodesk.

 

Created a modified grbl.cps file with the modifications function you sent me to.

This correction if for another post processor: prototrak

 

I get errors where no g-code is created.

I will place another call to support to get assistance.

0 Likes
Message 8 of 13

prdurand
Participant
Participant

modifications to grbl.cps made (see attached new post-processor file)

Same error occurs.

0 Likes
Message 9 of 13

boopathi.sivakumar
Autodesk
Autodesk

you might also need to call all the circular function form circle

Replace all the onCircular function with this below attached codes

function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
  // one of X/Y and I/J are required and likewise
  
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation cannot be activated/deactivated for a circular move."));
    return;
  }

  var start = getCurrentPosition();
  var circle = new CircularData(getCircularPlane(), new Vector(cx, cy, cz), new Vector(x, y, z));
  
  if (isFullCircle()) {
    if (isHelical()) {
      linearize(tolerance);
      return;
    }
    switch (getCircularPlane()) {
      case PLANE_XY:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3),
          iOutput.format(circle.offset.x), jOutput.format(circle.offset.y), feedOutput.format(feed)
        );
        break;
      case PLANE_ZX:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3),
          iOutput.format(circle.offset.x), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      case PLANE_YZ:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3),
          jOutput.format(circle.offset.y), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      default:
      linearize(tolerance);
    }
  } else {
    switch (getCircularPlane()) {
      case PLANE_XY:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          iOutput.format(circle.offset.x), jOutput.format(circle.offset.y), feedOutput.format(feed)
        );
        break;
      case PLANE_ZX:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          iOutput.format(circle.offset.x), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      case PLANE_YZ:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          jOutput.format(circle.offset.y), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      default:
      linearize(tolerance);
    }
  }
}

This will get you the right codes

 

Also you can try changing this settings as well to control single arc angle by default it will be 180 you can change to 90 or any angle to control the arc length angle

maximumCircularSweep = toRad(180);

Let me know how it goes

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 10 of 13

prdurand
Participant
Participant

Forgive me, but I do not understand your instructions from the last message.

0 Likes
Message 11 of 13

prdurand
Participant
Participant

can you explain in more detail what I need to do?

0 Likes
Message 12 of 13

boopathi.sivakumar
Autodesk
Autodesk

Open the post in any editor

and find for function onCircular

You will get to see the codes like this. 

  case PLANE_YZ:
    yOutput.reset();
    zOutput.reset();
    jOutput.reset();
    kOutput.reset();
    break;
  }
}
// Select the codes form here>>>>>>>>>>>>>>>>>>>>>>>>>>>
function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
  // one of X/Y and I/J are required and likewise
  
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation cannot be activated/deactivated for a circular move."));
    return;
  }

  var start = getCurrentPosition();

  if (isFullCircle()) {
    if (isHelical()) {
      linearize(tolerance);
      return;
    }
    switch (getCircularPlane()) {
    case PLANE_XY:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), iOutput.format(cx - start.x), jOutput.format(cy - start.y), feedOutput.format(feed));
      break;
    case PLANE_ZX:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), zOutput.format(z), iOutput.format(cx - start.x), kOutput.format(cz - start.z), feedOutput.format(feed));
      break;
    case PLANE_YZ:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), yOutput.format(y), jOutput.format(cy - start.y), kOutput.format(cz - start.z), feedOutput.format(feed));
      break;
    default:
      linearize(tolerance);
    }
  } else {
    switch (getCircularPlane()) {
    case PLANE_XY:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx - start.x), jOutput.format(cy - start.y), feedOutput.format(feed));
      break;
    case PLANE_ZX:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx - start.x), kOutput.format(cz - start.z), feedOutput.format(feed));
      break;
    case PLANE_YZ:
      forceCircular(getCircularPlane());
      writeBlock(gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), jOutput.format(cy - start.y), kOutput.format(cz - start.z), feedOutput.format(feed));
      break;
    default:
      linearize(tolerance);
    }
  }
}
// Upto here>>>>>>>>>>>>>>>>>>>>
var mapCommand = {
  COMMAND_STOP:0,
  COMMAND_END:2,
  COMMAND_SPINDLE_CLOCKWISE:3,
  COMMAND_SPINDLE_COUNTERCLOCKWISE:4,
  COMMAND_STOP_SPINDLE:5
};

 

 

select the codes as mentioned above and replace with the below codes

function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
  // one of X/Y and I/J are required and likewise
  
  if (pendingRadiusCompensation >= 0) {
    error(localize("Radius compensation cannot be activated/deactivated for a circular move."));
    return;
  }

  var start = getCurrentPosition();
  var circle = new CircularData(getCircularPlane(), new Vector(cx, cy, cz), new Vector(x, y, z));
  
  if (isFullCircle()) {
    if (isHelical()) {
      linearize(tolerance);
      return;
    }
    switch (getCircularPlane()) {
      case PLANE_XY:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3),
          iOutput.format(circle.offset.x), jOutput.format(circle.offset.y), feedOutput.format(feed)
        );
        break;
      case PLANE_ZX:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3),
          iOutput.format(circle.offset.x), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      case PLANE_YZ:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3),
          jOutput.format(circle.offset.y), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      default:
      linearize(tolerance);
    }
  } else {
    switch (getCircularPlane()) {
      case PLANE_XY:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          iOutput.format(circle.offset.x), jOutput.format(circle.offset.y), feedOutput.format(feed)
        );
        break;
      case PLANE_ZX:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          iOutput.format(circle.offset.x), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      case PLANE_YZ:
        forceCircular(getCircularPlane());
        writeBlock(
          gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3),
          xOutput.format(circle.end.x), yOutput.format(circle.end.y), zOutput.format(circle.end.z),
          jOutput.format(circle.offset.y), kOutput.format(circle.offset.z), feedOutput.format(feed)
        );
        break;
      default:
      linearize(tolerance);
    }
  }
}

 Hope its clear now


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 13 of 13

prdurand
Participant
Participant

Now I understand.

I replaced the onCircular function with the code in your email.

I had to reformat this code because there were no CR/LF . I attache that file grbl_boopathi_2.cps

I ran a post process with the new grbl_boopathi_2.cps file and got the error in the .log file (XGLeftInside1001.log) attached.

When I run the post process with the Autodesk original grbl.cps it generates a post process G-Code .nc file.

 

Thank you very much for your help.

 

pierre

0 Likes