No Rapid Height after Drilling Operation

Having problems with or questions about SheetCam? Post them here.
Post Reply
Nedlohd
Posts: 2
Joined: Tue Jan 02, 2024 3:19 am

No Rapid Height after Drilling Operation

Post by Nedlohd »

Hi All.
Home built machine running chinese usb motion controller and Mach3.
Problem I have.
After Drilling Operation torch performs rapid move to next Cut Operation without going to Rapid Clearance Height which I have set at 15mm.
Between Cut Operations there is no problem. Torch raises to 15mm then Rapid moves to next Operation as expected.
I have attached the gcode and post.
If anyone can help it would be much appreciated.
Thanks.
Dave
Attachments
PLASMA THC SD.scpost
(8.57 KiB) Downloaded 74 times
SPINDLE SPANNER.tap
(1.54 KiB) Downloaded 69 times
Nedlohd
Posts: 2
Joined: Tue Jan 02, 2024 3:19 am

Re: No Rapid Height after Drilling Operation

Post by Nedlohd »

Anyone out there have any ideas about this?
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: No Rapid Height after Drilling Operation

Post by bLouChip »

I ran your scpost with the debugger and found that currentZ ~= safeZ test in OnRapid() was preventing the posting of Z15, notice the G00 was posted in your .tap.
btw- In that same "if" stmt, you are testing offZ as if its boolean but its not, its numeric and thus will always test TRUE unless its nil (I seem to recall that from the Lua language reference). I'm guessing that the currentZ ~= safeZ test is to prevent posting a no-motion Z value, if so, ModalNumber() takes care of that case, so the test can be removed ? I removed it, as well as offZ since if its zero then it has no effect to the endZ+offZ result. I compared before and after .tap files with this OnRapid() change and the only difference was the G00 Z15.000 vs. G00 stmt.

Perhaps an alternative to changing OnRapid() as noted above and in the posted function below, try adding [correction] currentZ = endZ in OnDrill() after returning from OnMove() and before OnPenUp() call. I didn't try this but it may solve the problem also.

In OnDrill(), consider using endZ = safeZ instead of endZ = 15.

Code: Select all

function OnRapid()
   if(endX > 1e17 and endY > 1e17) then return end
   local len = math.hypot((endX + offX)-currentX , (endY + offY)-currentY)
   dist = dist + len
   if len < 0.001 and endZ < currentZ and endZ == pierceHeight then
      return --Block the move to pierce height
   end
   
   post.ModalText (" G00")
   post.ModalNumber (" X", (endX + offX) * scale, "0.0000")
   post.ModalNumber (" Y", (endY + offY) * scale, "0.0000")
--   if(offZ and firstRef == false and currentZ ~= safeZ) then
   if not firstRef then  --LDC
      post.ModalNumber (" " .. currentZAxis, (endZ + offZ) * scale, "0.0000")
   end
   post.Eol()
end
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
Post Reply