Hello Guest it is January 20, 2021, 05:17:12 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - tjpilson

Pages: 1
Daz, I went ahead and implemented your script on my machine with good results.  Thank you for the assist!  While I was getting some manual tool change success with the script I posted earlier in the thread (using the mc.mcCntlToolChangeManual), after the probe would run and the cycle start happened, every encounter of an I and J word would cause the machine to jump to unknown coordinates and make a sweeping arc.  I guess Mach was loosing it's incremental reference point as a result of the mc.mcCntlToolChangeManual operation.  Oh well, I'm abandoning that in favor of the mc.mcCntlCycleStop.

Now I just have to figure out how to get my Auto Tool Zero to function while in that mc.mcCntlCycleStop state.

This is the exact scenario I'm trying to resolve as well.  (recently migrated from Mach3 > Mach4)  It worked exactly as described in Mach3.  On M6, machine would stop and prompt for a tool change.  I could manually jog the machine to a convenient/ad-hoc location of my choosing, change the bit, move the machine back to a location for zeroing against the workpiece, hit the "auto tool zero" button to reset Z height, and then hit "cycle start".  The machine would move to the next location and operations would resume.

Auto Tool Zero - button script/"left up" (adapted from Daz)
Code: [Select]
local TouchPlate = 0.1085 -- toolsetter height in inches
local StartHeight = 0.5 -- once probed, the final retract height

-- Initial Probe --
mc.mcCntlSetLastError(0, "Initiating probe with 2 touches");
AutoToolSetGcode = ""
AutoToolSetGcode = AutoToolSetGcode .. "G91 G31 Z-1.50 F4\n" -- initial move downward to probe
AutoToolSetGcode = AutoToolSetGcode .. "G91 Z0.125 F30\n"  -- retract
AutoToolSetGcode = AutoToolSetGcode .. "G91 G31 Z-1.00 F2\n" -- move down again, slower to probe
mc.mcCntlGcodeExecuteWait(0, AutoToolSetGcode) -- execute gcode

-- Set Z --
mc.mcCntlSetLastError(0, "Resetting Z axis");
mc.mcAxisSetPos(0, mc.Z_AXIS, TouchPlate) -- zero the Z axis
FinalPosition = StartHeight - TouchPlate
AutoToolSetGcode = ""
AutoToolSetGcode = AutoToolSetGcode .. string.format("G91 Z%.4f F30\n", FinalPosition)
mc.mcCntlGcodeExecuteWait(0, AutoToolSetGcode) -- move back
mc.mcCntlSetLastError(0, "Probe complete");

-- Message Box --
wx.wxMessageBox("Z Height Set, Remove TouchPlate")

Pages: 1