I recently started using G54-G56 for some different operations (G54 - current workpiece center, G55 - Lower left corner for probing, G56 - alternate workpiece center).
I was getting some crazy behavior where my XY0 would move all over the place after setting 0 and switching between WCS.
The problem:
G92 commands shift ALL workspaces!
For this reason, replacing G92 became top priority and this was the result:
- Set zero button behavior in Eding CNC to L10P....
- Replace any G92 commands with corresponding G10, for example:
G10 L20 P[#5220] X0Y0 ; Set current WCS offset [#5220] X and Y zero
G4p0.2 ; pause .2 seconds
So Schallbert thanks again for the idea, you ended up saving me a ton of frustration and helped me get to a valuable Gcode lesson. Using #5220 lets me stay in my "operational" workspace and I can leave the actual XY0 alone in another G5x space.
Updated ZHC macro and a new macro I made to make sure I don't forget to use ZHC (called in the post processor header):
sub zhcmgrid ; Surface Probing routine for uneven surface milling
;#5151 is current ZHC status (1 = ON, 0 = OFF)
; 'ZHCINITEX' is used for different grid sizes across X and Y
;Check that tool is 3D probe
IF [#5008 < 98] ; 3D probe not inserted
msg "Canceled: Must use 3D probe for scanning"
;scanning starts at Work x=0, y=0 and moves positive
#4100 = 4 ;number x points
#4101 = 2 ;number y points
#4104 = [[#4112]/[[#4100]-1]] ;X grid distance = X length div by npoints minus 1
#4105 = [[#4113]/[[#4101]-1]] ;Y grid distance = Y length div by npoints minus 1
#4106 = 100 ;probing feed
#4114 = 0 ;Buffer distance X (from X0)
#4115 = 0 ;Buffer distance Y (from Y0)
#4109 = 0 ;Missed measurements counter
#4110 = 0 ;Number of points added
#4111 = 1 ;0: odd x row, 1: even xrow
dlgmsg "Is XYZ0 set to lower left corner?"
IF [#5398 == 1] ; user pressed OK
dlgmsg "Surface Grid Probing" "X Length" 4112 "Number of X points (2 or more)" 4100 "Y Length" 4113 "Number of Y points (2 or more)" 4101 "Clearance Z height (WCS)" 4102 "Z Probe depth from 0 (WCS)" 4103 "X clearance distance from 0" 4114 "Y clearance distance from 0" 4115
;calculate grid size based on length and desired number of points
;#4104 = [[#4112]/[[#4100]-1]] ;X grid distance = X length div by npoints minus 1
;#4105 = [[#4113]/[[#4101]-1]] ;Y grid distance = Y length div by npoints minus 1
#4104 = [[#4112-[2*[#4114]]]/[[#4100]-1]] ;X grid distance = X length - buffer distance div by npoints minus 1
#4105 = [[#4113-[2*[#4115]]]/[[#4101]-1]] ;Y grid distance = Y length - buffer distance div by npoints minus 1
msg "X grid size: " #4104 " Y grid size: " #4105
;Save current XY0 for recall later and reset XY0 to buffer distance
G53 G0 z[#4506] ; Z safe height
#4116 = #5071 ;Save Current X Pos (Machine)
#4117 = #5072 ;Save Current Y Pos (Machine)
g4p0.2 ; pause .2 seconds
G0 X[#4114] Y[#4115] ;move to buffer start point
G10 L20 P[#5220] X0Y0 ; Set current WCS offset [#5220] X and Y zero
g4p0.2 ; pause .2 seconds
G0 z[#4102];to Z clearance height
;ZHCINITEX <grid sizeX> <grid sizeY> <n of points in X> <n of points in Y>
ZHCINITEX [#4104] [#4105] [#4100] [#4101] ;define gridSize nx ny
#4108 = 0 ;current ny value
WHILE [#4108 < #4101] ;current Y counter is less than Y points
IF [#4111 == 1] ; row is even
G0 x[#4107 * #4104] y[#4108 * #4105] ;to new scan point [current n * grid distance]
G38.2 F[#4106] z[#4103];probe down until touch
;Add point to internal table IF probe has touched
msg "nx="[#4107 +1]" ny="[#4108+1]" added"
msg "nx="[#4107 +1]" ny="[#4108+1]" not added"
#4107 = [#4107 + 1] ;next nx
;odd x row, go from nx to 0
#4107 = [#4100 - 1] ;start nx
G0 x[#4107 * #4104] y[#4108 * #4105] ;to new scan point [current n * grid distance]
g38.2 F[#4106] z[#4103];probe down until touch
;Add point to internal table IF probe has touched
msg "nx="[#4107 +1]" ny="[#4108+1]" added"
msg "nx="[#4107 +1]" ny="[#4108+1]" not added"
#4107 = [#4107 - 1] ;next nx
#4108 = [#4108 + 1] ;next ny
G53 G0 z[#4506] ;Go to Safe Z
G53 G0 X[#4116] Y[#4117] ;move to original XY0
G10 L20 P[#5220] X0Y0 ; Reset current WCS offset X and Y zero
ZHCS zHeightCompTable.txt ;Save measured table
msg "Done, "#4110" points added, "#4109" not added"
ZHCcheck 20 ;list ZHC statistics
ELSE ;user pressed cancel in dialog
msg "Canceled: Restart when XYZ 0 is set to lower left corner"
SUB ZHC_CHECK ; macro called from header of postprocessor to ensure jobs aren't run without ZHC by mistake, and also reset Z0 after enabling ZHC
IF [[#5151 == 0] AND [#5397 == 0]] ; ZHC off and RENDER Mode off
dlgmsg "Turn on ZHC and set Z0?"
IF [#5398 == 1] ; OK-button
dlgmsg "Remove probe and continue"
IF [#5398 == -1] ; Cancel-button
msg "Canceled job and reset ZHC"
Alles anzeigen