Here is a program I use to surface all boards and I use it to surface the table as well.
The origin is in the center to make it easy and useful no mater which corner my real origin will be for the job.
Once the board is surfaced then I can probe the origin properly.
The toolpath starts at the front left corner and moves clockwise around the board and spirals in to the center. I prefer this over parallel lace pattern for surfacing since this will eliminates the risk of chipping out or splintering the wood around the edges.
For boards I just set the origin to the center of the board ( eye ball and tape measure is all I use ). Then fill in the 6 settings in the config section at the top of the code. For boards I go a little extra all around on the size to make it easy.
For surfacing the table of course I find the center of the travels accurately and enter the full travel as the X and Y numbers.
Z0 for this is the top of the workpiece and the tool will start .10" above Z0 and ramp at 5 degrees for each pass.
For metric people you will have to find and change:
G20 and change it to G21
G0 Z.1 and change it to G0 Z2.5 ( 2 places to change for that )
“#<_ramp_depth> = .087” and change it to “#<_ramp_depth> = 2.21”
“X-[#<_xpos> - 1]” and change it to “X-[#<_xpos> - 25.4]” ( 4 places )
The Masso controller has a surfacing macro built right in and I want this to be as good for the Buildbotics.
% (SURFACE RECTANGE FROM OUTSIDE - ORIGIN IS CENTER, Z0 TOP)
(WIDTH ON X)
#<x_width> = 6
(LENGTH ON Y)
#<y_length> = 3.5
(DEPTH TO GO DOWN IN ONE PASS, USE NEGATIVE)
#<pass_depth> = -.02
(FINAL DEPTH, USE NEGATIVE)
#<final_depth> = -.04
(STEPOVER, DON'T GO OVER 80% OF CUTTER DIAMETER)
#<stepover> = 1
(FEEDRATE)
#<_feedrate> = 300
(END OF CONFIG SECTION)
; Final depth must be below, or equal to, pass depth
o100 IF [#<final_depth> GT #<pass_depth>]
M0 (MSG, FINAL DEPTH MUST NOT BE HIGHER THAN PASS DEPTH - ABORTING)
M2
o100 ENDIF
#<_xpos> = [#<x_width> / 2] ; Origin is center so set x to half width
#<_ypos> = [#<y_length> / 2] ; Origin is center so set y to half length
#<_curr_depth> = -#<pass_depth> ; Set current depth to pass depth above Z0
#<_depth> = #<pass_depth> ; Set first pass depth
#<_ramp_feed> = [#<_feedrate> / 2] ; Reduce feedrate by 50% for ramp
; Ramping sub
o101 SUB
G0 Z.1 ; Reset for next pass
X-[#<_xpos> - 1] Y-#<_ypos> ; Ramp position
G1 Z#<_curr_depth> F#<_ramp_feed> ; Starting point height
#<dist> = [#<_curr_depth> - #<_depth>] ; distance down we need to go
#<_ramp_depth> = .087 ; 5 degree ramp over 1 inch
#<ramps> = [FIX[#<dist> / #<_ramp_depth>]] ; number of 5 deg. ramps we need to make
o102 REPEAT [#<ramps>]
#<_curr_depth> = [#<_curr_depth> - #<_ramp_depth>]
G1 X-[#<_xpos> - 1] Y-#<_ypos> F#<_feedrate> ; Ramp position
X-#<_xpos> Z#<_curr_depth> F#<_ramp_feed> ; Ramp
o102 ENDREPEAT
; If current depth is not yet to pass depth
o103 IF [#<_curr_depth> GT #<_depth>]
G1 X-[#<_xpos> - 1] Y-#<_ypos> F#<_feedrate> ; Ramp position
X-#<_xpos> Z#<_depth> F#<_ramp_feed> ; Ramp
o103 ENDIF
#<_curr_depth> = #<_depth>
F#<_feedrate> ; Feedrate 100% to mill pass
o101 endsub
G0 G90 G17 G20
G53 G0 Z0
X-[#<_xpos> - 1] Y-#<_ypos> ; Ramp position
; Call sub to do ramps
o101 call
; While depth is greater than or equal to final depth
o104 WHILE [#<_depth> GE #<final_depth>]
; When x or y reach center pass is done
o105 WHILE [#<_xpos> GT 0 AND #<_ypos> GT 0]
Y#<_ypos>
X#<_xpos>
Y-#<_ypos>
X-#<_xpos>
#<_xpos> = [#<_xpos> - #<stepover>] ; Reduce path by stepover amount
#<_ypos> = [#<_ypos> - #<stepover>]
; If X has gone past center then pass is done
o106 IF [#<_xpos> LT 0]
#<_xpos> = 0
X#<_xpos> Y-#<_ypos>
Y#<_ypos>
; Else if Y has gone past center then pass is done
o106 ELSEIF [#<_ypos> LT 0]
#<_ypos> = 0
X-#<_xpos> Y#<_ypos>
X#<_xpos>
o106 ELSE
X-#<_xpos> Y-#<_ypos> ; Moves toward center to next path position
o106 ENDIF
o105 ENDWHILE
; If depth is equal to final depth
o107 IF [#<_depth> EQ #<final_depth>]
#<_depth> = [#<_depth> + #<pass_depth>] ; Set too deep to trigger while exit
o107 ELSE
#<_depth> = [#<_depth> + #<pass_depth>] ; Set to next pass depth
; If depth is less than final depth
o108 IF [#<_depth> LT #<final_depth>]
#<_depth> = #<final_depth> ; Set to final depth
o108 ENDIF
#<_xpos> = [#<x_width> / 2] ; Reset x to start position
#<_ypos> = [#<y_length> / 2] ; Reset y to start position
; Call sub to do ramps
o101 call
o107 ENDIF
o104 ENDWHILE
G1 Z.1
G53 G0 Z0
M30
%