Skip to content

Instantly share code, notes, and snippets.

@dberlin
Last active May 9, 2023 05:04
Show Gist options
  • Save dberlin/b6753787d362f631a6baa6ccbf2b4fef to your computer and use it in GitHub Desktop.
Save dberlin/b6753787d362f631a6baa6ccbf2b4fef to your computer and use it in GitHub Desktop.
gcode for wincnc that finds the center of a circle
G90
G92
[X probing]
L210X [Switch low limit on X axis]
[The m28 and g31 on the next line make WinCNC stop when the limit switch is hit instead of aborting like it normally would)
l91 G1X-10 M28 G31 F30 [probe 10 inches in the negative X direction till we trigger the probe]
l212 [switch limits back]
l1 N28 V{AP0} [store current absolute position to register 28]
l91g0X0.05 [back off a little]
l211X [switch high limit on X axis]
l91g1X10 m28 g31 f30 [probe 10 inches in positive X direction till we trigger the probe]
l212 [switch limits back]
l1 N29 V{AP0} [store absolute position to register 29]
L91G0X-0.05 [back off]
L90G0X{(PH28+PH29)/(2))} [Move to center in X direction]
[Y Probing]
L210Y [Switch low limit on Y axis]
l91 G1Y-10 M28 G31 F30 [probe 10 inches in the negative Y direction till we trigger the probe]
l212 [switch limits back]
l1 N28 V{AP0} [store absolute position to register 28]
l91g0Y0.05 [back off a little]
l211Y [switch high limit on Y axis]
l91g1Y10 m28 g31 f30 [probe 10 inchesin positive Y direction till we trigger the probe]
l212 [switch limits back]
l1 N29 V{AP0} [store absolute position to register 29]
L90G0Y{(PH28+PH29)/(2))} [Move to center in Y direction]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment