Surfacing Macro
-
@jay_s_uk you just adjust the step over. So if you were using a 1/4in end mill you'd set the step over to like 2mm. I'm using a 1" surfacing bit so I set it to 10mm. Seems to leave a nice finish.
-
@cthulhulabs fantastic! I look forward to trying this when I next need it
-
@cthulhulabs This is really impressive! Thanks for sharing. I plan on trying it out soon myself!
-
@sindarius / @jay_s_uk
Get a chance to try this out? Trying to see if there are any ways to improve it. -
@cthulhulabs It's been too cold in my garage to want to do any woodworking at the moment
I do have the macro copied over to my machine once it warms up enough to be in there.
-
It would be nice if this macro could be made into a plugin. Then you wouldn't have to edit the macro to change parameters. Something like the CNC touchprobe plugin by @raymondstone
-
damn that would be another reason for me to update my old duet2w from RRF2.1 to 3.3
no build another cnc first -
I tested this macro today. Works nicely, had to edit some parameters for my Ooznest touchprobe input. Thanks a lot
; Adjust probe for low speed probing M558 K0 P8 C"!e0stop" H20 F120 T300 ; Z probe number - Z probe switch type - probe recovery 1s probe speed and travel speed
-
@cthulhulabs i like this macro! I am trying ot use it by I am encountering a couple of hiccups. I know this is an older thread, but I am hoping you might see this reply.
-
Are you using a PanelDue in conjunction with your machine?
-
Where/how are you controlling your spindle?
-
I am getting funny outputs with the move command prompts on PanelDue. I get the first one for probing Z. but not for any of the other ones. M291 Syntax looks correct. I am trying to get a PC near the machine to see what the console looks like.
M291 P"Insert your surfacing bit into your spindle and position it above the probe plate" R"Probing" S3 X1 Y1 Z1 ; Set bit above center of probe G91 ; relative positioning ; Probe Z component G38.2 Z{move.axes[2].userPosition - (var.ProbeThickness + 2.25)} ; seek until the probe circuit is closed Z-axis 25 mm G0 Z{var.ZClearanceHeight} ; rapid move Z axis 5 mm G10 P1 L{var.CoordSystem} Z{var.ProbeThickness + var.ZClearanceHeight} ; store relative probe offset for coordinates system 1 G90 ; Absolute positioning M291 P"Move to the starting X Y position for surfacing" R"Start Position" S3 X1 Y1 Z0 set var.StartX = move.axes[0].userPosition; set var.StartY = move.axes[1].userPosition; if var.Debug M118 P0 S{"StartX = " ^ var.StartX} L2 M118 P0 S{"StartY = " ^ var.StartY} L2 M291 P"Move to the ending X Y position for surfacing" R"End Position" S3 X1 Y1 Z0 set var.EndX = move.axes[0].userPosition; set var.EndY = move.axes[1].userPosition;
- How or where are you turning your spindle on? As mine is controlled through RRF, I need to insert the tokens to turn off/on. I am thjnking before and after the while loop?
T1 G90 M03 S5000 G04 S1 G0 X0.0000 Y0.0000 Z3.0000 ; Begin surfacing loop while true ... ... M291 P"Surface another layer?" S3 X0 Y0 Z0 ; then prompt the user if they want to do another layer M03 S3500 ; ramp spindle speed down G04 S1 M03 S1500 G04 S1 M05 G04 S1 G90 G0 X0.0000 Y0.0000 Z3.0000
-
-
@sinned6915 I have modified the macro for an Ooznest Workbee with their latest Firmware (RRF3.3). M3 starts the router and M5 stops it.
; Constants var Debug = false; var ProbeThickness = 5; var CoordSystem = 20; var StepOver = 10; var DepthOfCut = 0.2; var FeedRate = 8000; var ZClearanceHeight = 25; ; Variables var StartX = 0; ; The X starting position var StartY = 0; ; The Y starting position var EndX = 0; ; The X ending position var EndY = 0; ; The Y ending position var YDir = 0; ; The direction to go in Y var YDist = 0; ; The distance to go in Y var YPos = 0; ; The position in Y to move to var YDistLeft = 0; ; How much we have left to move in Y var ZDepth = 0; ; How far down we should be in Z var XSorE = "End" ; Whether X should move towards the start or the end position ; If the printer hasn't been homed, home it if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 ; Adjust probe for low speed probing M558 K0 P8 C"!e0stop" H20 F120 T300 ; Z probe number - Z probe switch type - probe recovery 1s probe speed and travel speed G31 K0 P500 X0 Y0 Z0 ; Set trigger value - set offset and trigger height - Z probe number M291 P"Insert your surfacing bit into your spindle and position it above the probe plate" R"Probing" S3 X1 Y1 Z1 ; Set bit above center of probe G91 ; relative positioning ; Probe Z component G38.2 Z{move.axes[2].userPosition - (var.ProbeThickness + 2.25)} ; seek until the probe circuit is closed Z-axis 25 mm G0 Z{var.ZClearanceHeight} ; rapid move Z axis 5 mm G10 P1 L{var.CoordSystem} Z{var.ProbeThickness + var.ZClearanceHeight} ; store relative probe offset for coordinates system 1 G90 ; Absolute positioning M291 P"Move to the starting X Y position for surfacing" R"Start Position" S3 X1 Y1 Z0 set var.StartX = move.axes[0].userPosition; set var.StartY = move.axes[1].userPosition; if var.Debug M118 P0 S{"StartX = " ^ var.StartX} L2 M118 P0 S{"StartY = " ^ var.StartY} L2 M291 P"Move to the ending X Y position for surfacing" R"End Position" S3 X1 Y1 Z0 set var.EndX = move.axes[0].userPosition; set var.EndY = move.axes[1].userPosition; if var.Debug M118 P0 S{"EndX = " ^ var.EndX} L2 M118 P0 S{"EndY = " ^ var.EndY} L2 M291 P"Are you ready to begin surfacing?" S3 X0 Y0 Z0 ; Figure out which direction in Y we are going if var.EndY < var.StartY set var.YDir = -1; elif var.EndY > var.StartY set var.YDir = 1; else set var.YDir = 0; if var.Debug M118 P0 S{"YDir = " ^ var.YDir} L2 set var.YDist = {abs(var.StartY - var.EndY)}; if var.Debug M118 P0 S{"YDist = " ^ var.YDist} L2 ; Begin surfacing loop while true if var.Debug M118 P0 S"Begin Layer Loop" L2; set var.ZDepth = {var.ZDepth - var.DepthOfCut}; set var.YDistLeft = {var.YDist}; ; go to the start X and Y position then down to Z Depth if var.Debug M118 P0 S{"Move to start X" ^ var.StartX ^ ",Y" ^ var.StartY} L2 T1 M3 S17500 ;M42 P1 S1 G0 X{var.StartX} Y{var.StartY} if var.Debug M118 P0 S{"Move to start Z" ^ var.ZDepth} L2 G1 Z{var.ZDepth} ; we should be at the Start X position so move to the End X position if var.Debug M118 P0 S{"Move to X" ^ var.EndX} L2 G1 X{var.EndX} F{var.FeedRate} set var.XSorE = "Start" while var.YDistLeft > var.StepOver if var.Debug M118 P0 S"Begin Y Loop" L2 ; move in Y by StepOver set var.YPos = {move.axes[1].userPosition + (var.StepOver * var.YDir)} if var.Debug M118 P0 S{"Move to Y" ^ var.YPos} L2 G1 Y{var.YPos} F{var.FeedRate} set var.YDistLeft = {var.YDistLeft - var.StepOver} if var.XSorE == "Start" ; move X to the start position if var.Debug M118 P0 S{"Move to X" ^ var.StartX} L2 G1 X{var.StartX} F{var.FeedRate} set var.XSorE = "End" else ; move X to the end position if var.Debug M118 P0 S{"Move to X" ^ var.EndX} L2 G1 X{var.EndX} F{var.FeedRate} set var.XSorE = "Start" ; move in Y the rest of the distance left set var.YPos = {move.axes[1].userPosition + (var.YDistLeft * var.YDir)} if var.Debug M118 P0 S{"Move to Y" ^ var.YPos} L2 G1 Y{var.YPos} F{var.FeedRate} ; one last move in X if var.XSorE == "Start" ; move X to the start position if var.Debug M118 P0 S{"Move to X" ^ var.StartX} L2 G1 X{var.StartX} F{var.FeedRate} set var.XSorE = "End" else ; move X to the end position if var.Debug M118 P0 S{"Move to X" ^ var.EndX} L2 G1 X{var.EndX} F{var.FeedRate} set var.XSorE = "Start" G0 Z{var.ZClearanceHeight} ; get out of the way M400 ; wait for the movement buffer to catch up M5 ;M42 P1 S0 M291 P"Surface another layer?" S3 X0 Y0 Z0 ; then prompt the user if they want to do another layer
-
@chimaeragh thank you. i am downloading now and will try it again.
-
@sinned6915 Line 89 selects the tool (T1). If your spindle is set to tool 0 (T0) change it accordingly. Line 90 sends the M3 command to start the spindle.
-
@sinned6915 sorry for the late reply. Have not been on this forum for a while. No I am not using a PanelDue. I am using a Pi with an HDMI touch screen monitor. As for spindle I am using a Brushless Dewalt Trim Router with the ESC replaced with an ODrive. It currently requires running commands from odrivetool on the Pi.
@chimaeragh what all did you change in your version? I just upgraded to an ODrive Pro and can finally use an ADC input to control my spindle.
-
@cthulhulabs My DeWalt is configured as a spindle and is automated via a relay. So I can use M3 to start it and M5 to stop it. (Already modified my Vectric postprocessor for this)
I added M3 and M5 commands into the surfacing loop at line 89 and line 148 of the macro.T1 ; selects the spindle Tool 1
M3 S17500 ; starts tool
-
@chimaeragh Cool. There is a variable at the top for the spindle RPMs. Now that my spindle RPM can be controlled by the Duet I plan to add it. You should probably use that in your M3 command.
I am thinking of rewriting this Macro to only cut in one direction to give a more uniform surface finish. Basically cut from Left to Right, raise up, rapid to the next cut, lower and repeat. There would be a flag in it to change it between Left to Right and Right to Left. Might also add a flag to go from top to bottom or bottom to top.