Shapeoko 3 and CNCjs Multi workoffset zeroing

Hi Community.
I know. I should use carbide motion for SO3 but motion doesnt have easy G54-G59 offsets

But now for the problem. Have fairly big projeckt coming (small production) and planing to use all G offsets so i can max out machine space and productivity

Now when there is tool-change then CNCjs goes nicely and probes new tool and sets G54 new Z zero.
How could i make it Zero all G54-G59 so they all same. So i dont have to first probe G54 new tool and get new zero. and after that manually setting rest of the G55-59 to mach with G54.

I was trying to find some sort of g code comand what sets it… so maybe to do macro for that? or right now tool change in CNCjs is done by macro so edit that macro so it will write all G54-G59 same…

Hopefully some one can help.
For tool change im using Neilferreri macro. Maybe you can help or educate? :slight_smile: i was trying to read and figure out when the z zeroing happens but couldn’t figure it out. Is Probe command what automatically sets G54 new Z?

Best Regards and warm hopes
Silver

CM now has “Quick Actions” to execute short snippets of G-code wihtout a G-code file. There’s a button to create a Quick Action that saves the current work offset with a name. It’s not G54, etc. but it serves largely the same function.

5 Likes

Thank you for the Quick action tip.

After 6pack and couple of long late-night troubleshooting i managed to crack that egg
So i have managed to create macro for all the work coordinates.

First to thank neilferreri to have created macros for CNCjs for G54 tool change.
I discovered that i basically need to do sequnce for every WC separately. tho in one macro. didnt understand fully why needed to probe for every WC separately but ohh well… it works. So for those who have similar head ace as i had. Heres cure… Neilferreri macros with slight modification

For first initial macro. to define Z with tool

;Define all WC references
; Work offsets must be sett pefore running this 
; Wait until the planner queue is empty
%wait

; Set user-defined variables

%global.state.SAFE_HEIGHT = -3 ; clear everything height(negative number, distance below Z limit)
;Following set probe location
%global.state.PROBE_X_LOCATION = -2;machine coordinates
%global.state.PROBE_Y_LOCATION = -795 ;machine coordinates
%global.state.PROBE_Z_LOCATION = -36 ;machine coordinates → lower this (more negative) to start the probing closer to wasteboard
%global.state.TOOLC_X_LOCATION = -422 ; tool change location
%global.state.TOOLC_Y_LOCATION = -833
%global.state.TOOLC_Z_LOCATION = -10

%global.state.PROBE_DISTANCE = 100 ;Probe distants
%global.state.PROBE_RAPID_FEEDRATE = 350 ;mm/min

%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ;metric
M5 ;Stop spindle
G90 ;Absolute positioning

%wait

G53 G0 Z[global.state.SAFE_HEIGHT]
G53 X[global.state.PROBE_X_LOCATION] Y[global.state.PROBE_Y_LOCATION]
%wait
; Set up for probing…pause for attaching wires and stuff
; Here starts G54 define

G53 Z[global.state.PROBE_Z_LOCATION]
G91
G54
G38.2 Z-[global.state.PROBE_DISTANCE] F[global.state.PROBE_RAPID_FEEDRATE];fast probe(so it doesn’t take forever)
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
%global.state.TOOL_REFERENCE54 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE54 = [global.state.TOOL_REFERENCE54])

; Here starts G56 define

G91
G55
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
%global.state.TOOL_REFERENCE55 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE55 = [global.state.TOOL_REFERENCE55])

; Here starts G56 define

G91
G56
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
%global.state.TOOL_REFERENCE56 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE56 = [global.state.TOOL_REFERENCE56])

; Here starts G57 define

G91
G57
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
%global.state.TOOL_REFERENCE57 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE57 = [global.state.TOOL_REFERENCE57])

; Here starts G58 define

G91
G58
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
%global.state.TOOL_REFERENCE58 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE58 = [global.state.TOOL_REFERENCE58])

; Here starts G59 define

G91
G59
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5

%global.state.TOOL_REFERENCE59 = posz ;establish a global tool reference work offset
%wait
(TOOL_REFERENCE59 = [global.state.TOOL_REFERENCE59])

G90
G53 G0 Z[global.state.SAFE_HEIGHT]
M0
%wait
;Go to work zero at a SAFE_HEIGHT for Z
G54
G0 X0 Y0
; Restore modal state
[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

Heres the tool change macro

;Tool change for all WO G54-59
;This macro allows you to use a fixed machine location for a tool change/probe. Ideal when you’re workpiece surface has been carved away.

; Wait until the planner queue is empty
%wait

; Set user-defined variables

%SAFE_HEIGHT = -3 ; clear everything height(negative number, distance below Z limit)

%PROBE_DISTANCE = 100
%PROBE_RAPID_FEEDRATE = 450 ;mm/min

%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ;metric
M5 ;Stop spindle
G90 ;Absolute positioning

; goes to tool chane location
G53 G0 Z[global.state.SAFE_HEIGHT] ; mine tool change asukohta
G53 X[global.state.TOOLC_X_LOCATION] Y[global.state.TOOLC_Y_LOCATION]
%wait

;Pause for manual tool change & probing
M0
;Goes to Probe location
G53 G0 Z[global.state.SAFE_HEIGHT] ;mine probe asukohta
G53 X[global.state.PROBE_X_LOCATION] Y[global.state.PROBE_Y_LOCATION]
%wait

; probe sequence
G53 Z[global.state.PROBE_Z_LOCATION]
; here starts Probe for G54
G54
G91
G38.2 z-[global.state.PROBE_DISTANCE] F[global.state.PROBE_RAPID_FEEDRATE];fast probe (so it doesn’t take forever)
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
; Update Z offset for new tool
G10 L20 P1 Z[global.state.TOOL_REFERENCE54] ;G54 writes ower
%wait

; here starts Probe for G55
G55
G91
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
G10 L20 P2 Z[global.state.TOOL_REFERENCE55] ;G55 writes ower
%wait

; here starts Probe for G56
G56
G91
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
; Update Z offset for new tool
G10 L20 P3 Z[global.state.TOOL_REFERENCE56] ;G56 writes ower
%wait

; here starts Probe for G57
G57
G91
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
; Update Z offset for new tool
G10 L20 P4 Z[global.state.TOOL_REFERENCE57] ;G57 writes ower
%wait

; here starts Probe for G58
G58
G91
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
; Update Z offset for new tool
G10 L20 P5 Z[global.state.TOOL_REFERENCE58] ;G58 writes ower
%wait

; here starts Probe for G59
G59
G91
G0 z2
G38.2 z-5 F40 ;“dial-it-in” probes
G38.4 z10 F20
G4 P0.5
G90
; Update Z offset for new tool
G10 L20 P6 Z[global.state.TOOL_REFERENCE59] ;G59 writes ower
%wait

G90
G53 G0 Z[global.state.SAFE_HEIGHT]
%wait
;Go to work zero at a SAFE_HEIGHT for Z
G54
G0 X0 Y0
; Restore modal state
[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

didnt know the way of getting away with one probing only.
Probably its possible to make it more optimized… Put im not programmer. Im a chef who has side hobby to cnc and wood work :slight_smile:

Best regards
Silver

2 Likes

@neilferreri What do you think of the macros as defined by @SilverIllak ?

1 Like

In his use case, it probably makes more sense to use a dynamic tool length offset (G43.1) which will adjust the offset globally, across all work coordinate planes.
I discussed this with Silver via PM.

2 Likes

Working allready solution with G43.1

running demo and talking with Neilferreri of how to optimise and fool proof new macro. Moment its solid ill post it here

So so so… Did some study and knocked out new macro with G43.1

Have been testing it now past one week and it works for me nicely. it would make sense if tool reference and change values are done in machine coordinates (G53) but as now i dont know if CNCjs has posz command for G53.

*G43.1 is dynamic tool offset for Z
*When you activate first macro it will record and saves G54 Z value from probe.
*When you run second macro “tool change” then macro compares now G54 Z value with saved reference value, does simple math and difference is set as G43.1 and offsets the tool height in all WCS exept G53

  • When needed to deactivate tool offset you need to write in Console a command G49. This deactivates G43.1
  • When you plan to set new Z in same day cycle you must run first G49 other wise tool change offset will be wrong

So my workflow is:
I choose one fixed sized tool as “master tool” in my case round 6mm blank precision rod and ill push it max in.
I use one fixed “master tool” so i would have nice reference of what tool i did first Z zero and if needed i can re call and do sanity check.
And i could run relay easily multi day jobs

  1. Ill Zero all WCS. with “master tool” or first tool
  2. Ill run in G54 tool referencing macro
    a. if using first tool as ref. Then start cutting
  3. Then ill run Tool change macro with tool what im planing to use.
  4. When gcode done. Ill do tool change macro… and go cutting…

When New day and im still in same production…

  1. Ill load “master tool”
  2. ill run first macro “tool ref”
  3. change tool and run tool change macro
  4. some times ill do sanity check.
  5. Start cutting and changing tools with macro till day is over or something happens

When im planing in same day (i have not shutdown machine or program) to set new Z height

  1. Ill type in Command G49 so ill deactivate G43.1
  2. Probe or set new Z with “master tool” or first tool
  3. Run tool change macro
  4. Run gcode and make some chips
  5. Rinse and repeat 3-4 till jobs are done

Soo here comes the codes:
Firs i called Tool Reference

;Define tool first height for all WCS for future references
; Before launch macro, Set Z in G54 
; Make sure that you are in G54 WCS
; Need to launch this macro again when machine is switched off, program is closed or when you manually abort g-code

; Wait until the planner queue is empty
%wait

; Set user-defined variables

%global.state.SAFE_HEIGHT = -3 ; clear everything height(negative number, distance below Z limit)
;Following set probe location
%global.state.PROBE_X_LOCATION = -2;machine coordinates
%global.state.PROBE_Y_LOCATION = -795 ;machine coordinates
%global.state.PROBE_Z_LOCATION = -36   ;machine coordinates --> lower this (more negative) to start the probing closer to waste-board
%global.state.TOOLC_X_LOCATION = -422 ; tool change location
%global.state.TOOLC_Y_LOCATION = -833  ; Tool change location
%global.state.TOOLC_Z_LOCATION = -10 ;Tool change location

%global.state.PROBE_DISTANCE = 100 ;Probing distant
%global.state.PROBE_RAPID_FEEDRATE = 350 ;mm/min ; Speed how fast does first probe


%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ;metric
M5   ;Stop spindle
G90	;Absolute positioning


%wait

G53 G0 Z[global.state.SAFE_HEIGHT]
G53 X[global.state.PROBE_X_LOCATION] Y[global.state.PROBE_Y_LOCATION]
%wait
; Set up for probing...pause for attaching wires and stuff

; Here starts G54 define
G49 ; Cancel tool length offset

G53 Z[global.state.PROBE_Z_LOCATION]
G91
G38.2 Z-[global.state.PROBE_DISTANCE] F[global.state.PROBE_RAPID_FEEDRATE];fast probe(so it doesn't take forever)
G0 z2
G38.2 z-5 F40	;"dial-it-in" probes
G38.4 z10 F20
G4 P0.5
G90
G43.1 Z0
%global.state.TOOL_REFERENCE54 = posz	;establish a global tool reference work offset
%wait
(TOOL_REFERENCE54 = [global.state.TOOL_REFERENCE54])

G90
G53 G0 Z[global.state.SAFE_HEIGHT]
M0
%wait
 ;Go to work zero at a SAFE_HEIGHT for Z
G54
G0 X0 Y0
; Restore modal state
[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

And here is second macro what i called “tool change”

;Tool change for all WCS G54-59
;This macro allows you to use a fixed machine location for a tool change/probe. Ideal when you're work-piece surface has been carved away.
; This macro change tool change with G43.1 so differences apply in all WCS
; When you have started this macro for machine apply tool dynamic offset G43.1 (adds or retracts from reference number)
; To disable G43.1 type in command G49, or machine is shut down, program is closed, or when you manually stop g-code 
; ideal macro to run tool changes so they work in all WCS
; Make sure you are in G45 WCS before doing tool change

; Wait until the planner queue is empty
%wait

; Set user-defined variables

%SAFE_HEIGHT = -3 ; clear everything height(negative number, distance below Z limit)

%PROBE_DISTANCE = 100
%PROBE_RAPID_FEEDRATE = 450 ;mm/min


%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ;metric
M5   ;Stop spindle
G90	;Absolute positioning

; goes to tool change location
G53 G0 Z[global.state.SAFE_HEIGHT] ; go to tool change location
G53 X[global.state.TOOLC_X_LOCATION] Y[global.state.TOOLC_Y_LOCATION]
%wait


;Pause for manual tool change & probing
M0
;Goes to Probe location
G53 G0 Z[global.state.SAFE_HEIGHT] ;go to probe location
G53 X[global.state.PROBE_X_LOCATION] Y[global.state.PROBE_Y_LOCATION]
%wait

G49 ; Cancel tool length offset
; probe sequence
G53 Z[global.state.PROBE_Z_LOCATION]
; here starts Probe for G54
G54
G91
G38.2 z-[global.state.PROBE_DISTANCE] F[global.state.PROBE_RAPID_FEEDRATE];fast probe (so it doesn't take forever)
G0 z2
G38.2 z-5 F40	;"dial-it-in" probes
G38.4 z10 F20
G4 P0.5
G90
G43.1 Z[posz-global.state.TOOL_REFERENCE54] ; Makes offset of the tool

G90
G53 G0 Z[global.state.SAFE_HEIGHT]
%wait
;Go to work zero at a SAFE_HEIGHT for Z
G54
G0 X0 Y0
; Restore modal state
[WCS] [PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]

I hope its useful for some one else than me.
If something new happens. ill defiantly post it here
Thank you @neilferreri for first macros and some ideas and seeds for creating these macros
@CrookedWoodTex hope its useful for you.

Best regards
Silver

This topic was automatically closed after 30 days. New replies are no longer allowed.