Hello Guest it is May 06, 2021, 06:21:43 PM

Author Topic: Mach 4 Tool Auto Zero  (Read 15439 times)

0 Members and 1 Guest are viewing this topic.

Mach 4 Tool Auto Zero
« on: March 07, 2015, 05:35:15 AM »
I was trying to figure out a few things regarding tool auto-zero in Mach 4.

1. When the M6 code comes up when running a program it passes by the code as if it is a comment, NO it does not show up as (M6) in code. no brackets.
2. I see the button for tool auto-zero on the main "run Program" page, but alas, nothing comes of it when pressed.

I am new to Mach 4 so I am %99.99 SURE I missed something somewhere!

P.S. also what is the best recommended wiring for the touch-off plate, I plan on having one for tool change permenantly installed on the table.

Any and all help given is more than greatly appreciated.

V/R
Mike (it*guy)

Offline ger21

*
  • *
  •  6,289 6,289
    • View Profile
    • The CNC Woodworker
Re: Mach 4 Tool Auto Zero
« Reply #1 on: March 07, 2015, 07:44:14 AM »
1) Do you have an M6 macro in your Mach4Hobby\Profiles\macros\ folder?
The default macro stops and waits for you to press Cycle Start. The Tool Change LED should be blinking.

2) Like in Mach3, it's up to the user to implement the Auto Zero. I'm not aware of anyone doing it with Mach4 yet.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline Bodini

*
  •  216 216
    • View Profile
Re: Mach 4 Tool Auto Zero
« Reply #2 on: March 07, 2015, 07:42:35 PM »
2) Like in Mach3, it's up to the user to implement the Auto Zero. I'm not aware of anyone doing it with Mach4 yet.

Auto touch-off was the first thing I looked at in M4.  I tried converting over the script from the VB version in M3 to Lua in M4 but "IsMoving" does not work properly. I submitted the bug in the forum about 9 months ago I think, but it still didn't work when I checked a few days ago.  :-\

-Nick

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Mach 4 Tool Auto Zero
« Reply #3 on: March 07, 2015, 09:31:44 PM »
I think whats below is what you wont if wrong ever development team will say the squire or round one


mcCntlGCodeExecuteWait(inst, "G53 Y0 Z0")--Move back to the YOffset line
      if rc ~= mc.MERROR_NOERROR then return "Could not complete GCode motion", false end
   else
      mcCntlGCodeExecuteWait(inst, "G53 Y0 Z0")--Move to the YOffset line
      if rc ~= mc.MERROR_NOERROR then return "Could not complete GCode motion", false end

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Mach 4 Tool Auto Zero
« Reply #4 on: March 08, 2015, 12:30:51 PM »
--Take a poke at this and see if it works for your
--machine state, for probing. I don't have  a working probe,
--I am unable to test it. as an alternative, you could "NOT" the
--Run and Feedhold enums.

function test()
    local inst = 0; local state = 0; local rc = 0;
    --*****   Mach4 Enum machine states   *****
    local states = {["0"]   = "MC_STATE_IDLE",          --nothing going on, ok to probe
                    ["102"] = "MC_STATE_FRUN_PROBE",    --unknown if this is applicable
                    ["103"] = "MC_STATE_FRUN_PROBE_FH", --unknown if this is applicable
                    ["202"] = "MC_STATE_MRUN_PROBE",    --unknown if this is applicable
                    ["203"] = "MC_STATE_MRUN_PROBE_FH" }--unknown if this is applicable   
   
    state, rc = mc.mcCntlGetState(inst);

    if state == 0 or state == 102 or state == 103 or state == 202 or state == 203 then   
        state, rc = mc.mcCntlGetState(inst);
        if state == 0 then
            --states of instance that is running, i.e. RUN, STOP etc.                 
            wx.wxMessageBox("Number State = " .. tostring(state),
                            "String State " .. states[tostring(state)],
                            wx.wxOK);
            --If you got here, then it is OK to do probing, your code here......
        end
    end
end

if (mc.mcInEditor() == 1) then
    test();
end
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Mach 4 Tool Auto Zero
« Reply #5 on: March 11, 2015, 10:26:12 PM »
poppabear,
how do I test your code?

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Mach 4 Tool Auto Zero
« Reply #6 on: March 12, 2015, 09:03:03 AM »
1). Get a working probe.
2). Map probe to an input.
3). with probe tip held "ON", step the above code with a break point at "your probe code".
4). with mach in idle state, If you stop in that part of the code then that represents you getting the signal.
5). Write/test your probing code in real world, test, re-test under various conditions.
6). Modify, fix, rinse, repeat.
7). Probe stuff

Scott
« Last Edit: March 12, 2015, 09:04:45 AM by poppabear »
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Mach 4 Tool Auto Zero
« Reply #7 on: March 12, 2015, 02:06:59 PM »
the other way you can do it is with G code

something like this
G49 (Cancel TLO)

G58 (Switch to work offset G58)

G0 X10 Y20 (move the tool over the toolsetter)

G31 Z-10 F15 (probe tool down till it touches the toolsetter)

G10 L1 P1 Z#2002 (set the tool length offset value to the G58 Z position where the probe tripped)

G0 Z3 (move up to safe distance)

G54 (reapply old work offset coordinate system)

G43 H1 (apply new TLO for tool 1)
%

I have not tested it use at your own risk

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Mach 4 Tool Auto Zero
« Reply #8 on: March 15, 2015, 08:21:56 AM »
it*guy,

   So.......... did you get it to work yet?

Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Mach 4 Tool Auto Zero
« Reply #9 on: March 26, 2015, 05:47:09 PM »
not yet. I have been on a vacation away from the machine. I will be attempting to test it over the next few days. if anybody has any input for this since the last post please chime in!
Thanks,
V/R
Mike