What's new
What's new

Custom G-Code for Tool Path Offset

KChlud

Plastic
Joined
Aug 23, 2023
Could anyone help with creating custom G-Codes? I'm working on a mill, with FANUC 31i.

I'm trying to adjust a toolpath with an offset. I only need to do this with a certain tool, but it's different than a normal tool diameter compensation. I've been thinking about creating a custom G-Code that could be called, and offset the toolpath while active.

I'm not sure if it's possible to run a custom macro like this that actively adjusts an existing program as it occurs. I'm not sure how G41 or G42 applies a normal tool offset, but I'm thinking I may be able to alter something like this for what I need.

Does anyone have any suggestions on this?

Thank you!
 
Sorry! The best way I can describe it is having an offset spindle in X-Y direction. I need my programmed path to be offset by this difference. I don't need to follow a left or right compensation, but I need all of my programmed moves to be shifted to a new centerline.

Thank you for the help.
 
I think years ago that G41/2 could be used with I or J? as vectors to be applied other than the normal vectors that offset a contour equally. I don't know if that's changed, but maybe an old manual could be some inspiration. Other than that, changing offsets mid-profile might get you closer, like starting out with D1 and going to D11 (with a different value in the table) and maybe next to 21, then back to D1. What you might be looking for though, would be a macro that has a Do/While loop with a lot of math, then assign a gcode to that macro. ??? Spitballin'

edit: G45 thru G48 used to also be used like a G52. The terms was "single increase", "single decrease", "double increase" and "double decrease". You just had to make sure to use the opposite code when the profile was complete to zero out the offset.
 
Last edited:
I think years ago that G41/2 could be used with I or J? as vectors to be applied other than the normal vectors that offset a contour equally. I don't know if that's changed, but maybe an old manual could be some inspiration. Other than that, changing offsets mid-profile might get you closer, like starting out with D1 and going to D11 (with a different value in the table) and maybe next to 21, then back to D1. What you might be looking for though, would be a macro that has a Do/While loop with a lot of math, then assign a gcode to that macro. ??? Spitballin'
Thank you! I'll look for the G41 with I and J.

Right now I'm testing if a subprogram that updates my work offsets for the section needed, and then returns the values after would work.
 
Thank you! I'll look for the G41 with I and J.
That won't help you. What beege is referring to and this feature hasn't changed since day dot, is the method of describing to the control via the workpiece program, the presence of material ahead of where Tool Radius Comp is cancelled.

G52 is all that you need to achieve your result. This is defined as a Child Work Shift Offset by Fanuc and is a Shift added to ALL Workshift Coordinate Systems. For the tool that you have to shift the tool path, simply specify the amount and direction in X/Y with G52, then at the conclusion of the operation for that tool, cancel the effect of the Child Work Shift by specifying G52 X0.0 Y0.0.

Regards,

Bill
 
Last edited:
  • Like
Reactions: aj
That won't help you. What beege is referring to and this feature hasn't changed since day dot, is the method of describing to the control via the workpiece program, the presence of material ahead of where Tool Radius Comp is cancelled.

G52 is all that you need to achieve your result. This is defined as a Child Work Shift Offset by Fanuc and is a Shift added to ALL Workshift Coordinate Systems. For the tool that you have to shift the tool path, simply specify the amount and direction in X/Y with G52, then at the conclusion of the operation for that tool, cancel the effect of the Child Work Shift by specifying G52 X0.0 Y0.0.

Regards,

Bill
Thanks Bill!

Turns out it was as simple as this, I was jumping to an unnecessarily complicated solution.

Thank you everyone for all of your suggestions and help!
 








 
Back
Top