Rotating a coordinate system

I tried using the G10 L2 command to rotate my coordinate system, but it seems to ignore the rotation.

For example the following Gcode
G17 G20 G54 G90 G94 (xy plane, inches, coord system 1, abs dist mode, units per min mode)
G10 L2 P1 X0 Y0 R45 (p1 sets the g54 coord system, set x and y offset to zero, rotate 45 degrees around z axis)

Now if I do G1 X10 Y0 F100, it should be moving diagonally because the coordinate system is rotated. But instead it just moves along the x axis, ignoring the rotation.

Has anyone been able to get this to work? I wanted to write a gcode program that measures the orientation of the workpiece, and adjusts the coordinate system to match, but it looks like I won’t be able to without the G10 L2 command.

Interesting idea. I understand jogging ignores rotation. Could this be the case here? Have you tried running a file, perhaps cutting air, rather than mdi?

I’ve only tried it with the MDI so far. I’ll give your idea a shot this weekend.

this may/may not be relevant, but what design software are you running? On a previous CNC of mine (while running design in VCarve) I found I was able to modify the post processor file which allowed me to design in one view, then the G-code output was generated in a 90 degree rotation to the design. If that sounds helpful, I’ll see if I can find that info again…

My spoil board uses t-track rails that I don’t want to cover up with a permanent clamping fixture. I was hoping to be able to clamp a piece down, measure its angle, and have the cnc machine compensate. That angle would probably be under 1 degree.

I tried the idea @AndyP mentioned to run it from a file instead of the MDI and I didn’t have any luck there.

So now, my idea is to write a small Python script that will take a gcode file as input, find all the G0 and G1 commands and rotate them by an arbitrary amount. Its not done yet but it looks promising. The workflow will be

  • clamp down the work piece
  • Probe XYZ on the lower left corner
  • Write a gcode program to probe the lower right corner and report the orientation angle of the work piece
  • from my laptop, use the python script to rotate the gcode by the amount reported in the last step
  • upload the rotated gcode file to the cnc and go