Another Aussie Auto Tool Zero Setter - Page 28


Page 28 of 29 FirstFirst ... 182526272829 LastLast
Results 541 to 560 of 564

Thread: Another Aussie Auto Tool Zero Setter

  1. #541
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    The retract code that Daniellyall suggested should fix the issue:


    Code "G1 Z" &PlateThickness + RetractStroke &" F" &RetractFeedRate 'retract


    Jeff..

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  2. #542
    Registered
    Join Date
    Feb 2015
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Quote Originally Posted by jalessi View Post
    DownStroke = -25 'Set the down stroke to find probe
    DownFeedRate = 100 'Set the down FeedRate
    RetractStroke = 10 'Set the retract Stroke
    RetractFeedRate = 300 'Set the retract FeedRate

    CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
    CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
    CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
    PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G4 P2" ' this delay gives me time to get from computer to hold probe in place
    Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the axact point the probe was hit
    If Abs(ZprobePos) <= Abs(DownStroke)-0.1 Then 'Check if the probe has been found
    Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
    While IsMoving ()
    Wend
    Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G1 Z" &PlateThickness + RetractStroke &" F" &RetractFeedRate 'retract
    While IsMoving ()
    Wend
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    Else
    Code "G0 Z0" 'retract to start pos
    While IsMoving ()
    Wend
    Code "(Z-Plate not found, check connection or stroke and try again)" 'puts this message in the status bar
    End If
    Else
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    End If
    Code "F" &CurrentFeed 'Returns to prior feed rate
    If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
    Code "G91"
    End If
    If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
    Code "G0"
    End If
    Exit Sub
    so if i replace my code with this, i should be all set then?. I see it has the "Code "G1 Z" &PlateThickness + RetractStroke &" F" &RetractFeedRate 'retract" line in there.

    right?

    Thanks



  3. #543
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    OzzyFMC,

    Yes, As long as you are using the exact same screen set and the machine is set up for Metric.
    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  4. #544
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    OzzyFMC,

    I do not believe you are using the same screenset.

    Thats why I suggested only adding one additional line of code.

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  5. #545
    Registered
    Join Date
    Feb 2015
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Quote Originally Posted by jalessi View Post
    OzzyFMC,

    I do not believe you are using the same screenset.

    Thats why I suggested only adding one additional line of code.

    Jeff...
    ahhh gotcha. I understand... Thanks :-)



  6. #546
    Gold Member daniellyall's Avatar
    Join Date
    Sep 2009
    Location
    New Zealand
    Posts
    1856
    Downloads
    3
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    as long as the dro`s are there with the same code it will work on any screen set or they can just be added

    its just this bit that can be a problem

    PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here

    <img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />

    Being Disabled is OK CNC is For fuN


  7. #547
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Daniellyall,

    The entire code will not work with every screenset in its entirety as posted, you are confusing the issue.

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  8. #548
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    OzzyFMC,


    Be careful, someone is not giving good advice.

    Jeff...

    Last edited by jalessi; 02-18-2015 at 03:46 AM. Reason: Made a stupid suggestion to prove a point.
    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  9. #549
    Gold Member daniellyall's Avatar
    Join Date
    Sep 2009
    Location
    New Zealand
    Posts
    1856
    Downloads
    3
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    only do it if the dro 1151, Led 825 and OEMButton 1010 is there as I said above other wise it wont work as expected.

    Last edited by ger21; 02-18-2015 at 07:09 AM.
    <img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />

    Being Disabled is OK CNC is For fuN


  10. #550
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Quote Originally Posted by daniellyall View Post
    as long as the dro`s are there with the same code it will work on any screen set or they can just be added

    its just this bit that can be a problem

    PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Not entirely true.

    Do not use the code in its entirety, it will not function as expected.

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  11. #551
    Gold Member daniellyall's Avatar
    Join Date
    Sep 2009
    Location
    New Zealand
    Posts
    1856
    Downloads
    3
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    the funny thing is this was written for a different screen set than what I use so if it works on my machine as it already had the correct dro,led and button.

    why wont it work for ozyfmc as the code he posted is the same as the code I had before I changed to what I have now with the calls for the same dro, led and button

    I have pointed lots of people to this code with no problems reported back to me but I useley do a disclaimer I forget most of the time

    <img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />

    Being Disabled is OK CNC is For fuN


  12. #552
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Quote Originally Posted by daniellyall View Post
    the funny thing is this was written for a different screen set than what I use so if it works on my machine as it already had the correct dro,led and button.

    why wont it work for ozyfmc as the code he posted is the same as the code I had before I changed to what I have now with the calls for the same dro, led and button

    I have pointed lots of people to this code with no problems reported back to me but I useley do a disclaimer I forget most of the time
    Daniellyall,

    If the screensets are identical, I agree it will work flawlessly.

    If the screensets have different dro codes etc it will not work as expected.

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  13. #553
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Daniellyall,

    Many people read this thread, stating it will work with any screenset is not accurate.

    Stating it will work with any screenset except... is confusing.

    There is a big difference between saying "your screenset" verses "any screenset".

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  14. #554
    Member jalessi's Avatar
    Join Date
    Feb 2007
    Location
    United States
    Posts
    4553
    Downloads
    1
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Daniellyall,

    I am being critical of the wording so that someone reading only a portion of the post won't make a mistake.

    Sorry for being a d..k

    Jeff...

    Patience and perseverance have a magical effect before which difficulties disappear and obstacles vanish.


  15. #555
    Gold Member daniellyall's Avatar
    Join Date
    Sep 2009
    Location
    New Zealand
    Posts
    1856
    Downloads
    3
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    for a start it was (as long as the dro`s are there with the same code it will work on any screen set or they can just be added)

    so i said if the dro`s are there, what means if they are there it will work, the code was writin to go with hoss`s screen set I just added it to the one i have as it has the dro codes the same and the whole code worked.

    and I put or they can be added what means if you add the correct code to the dro`s and led`s it will work

    my screen set was different it worked why the codes where there as you say if they are identical it will work sorry wrong I did not have identical screen set and it works so that blows that idea out the window so please read all what I put in.

    and the other thing did I confirm that was the code I use no I did not you posted it not me yes it is the same and if you wont I can show you where it came from. this is the last time I am going to help anyone you can do it all

    <img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />

    Being Disabled is OK CNC is For fuN


  16. #556
    Registered
    Join Date
    Nov 2014
    Posts
    11
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Hi Guys I am having trouble getting auto zero to work for me ..on my Pc at home with it connected to any Machine or controller ..the flowing Sript appears to work ..but when i try it on the Pc that is connected to my machine ..nothing much happens ..any ideas are welcome or where can i post to ask for help ?

    Version Mach3 R3.042.040

    Script

    CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later

    PlateThickness = 6.0

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty

    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here

    Code "G91 G4 P2" ' P2 = two second delay

    Code "G31 Z-50.0 F100" 'Z goes down a max of 50.0mm at F100 = 100 mm per min

    While IsMoving() 'wait while it happens

    Wend

    ZProbePos = GetVar(2002) 'get the axact point the probe was hit

    Code "G90 G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun

    While IsMoving ()

    Wend

    Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness

    Code "G4 P0.25" 'Pause for Dro to update.

    Code "G90 G0 Z25.0" 'retract Z to 25.0mm

    Code "(Z axis is now zeroed test)" 'puts this message in the status bar

    Code "F" &CurrentFeed 'Returns to prior feed rate

    Else

    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable

    Exit Sub

    End If



  17. #557
    Registered
    Join Date
    Oct 2014
    Posts
    15
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Quote Originally Posted by Greolt View Post
    With the type of things I am doing on my router I find I very often need to set my Z axis zero on the top of the material.

    What I have been doing to set tool zero to the top of material is to use a 123 block as a known height gauge.

    Put it under the tool and jog down to it, using step jog when close, 0.01mm per step, then manualy entering 25.4mm (1") into the Z axis DRO.

    There's got to be a better way!


    Well there is. And lots of people have done this already. No original ideas here.

    This is what I did. With the help of some people on the Artsoft forum. Mostly Scott. Thanks Scott.

    Put a user DRO on the screen using Mach's screen utility, Screen4. Assigned it OEM code 1151

    Also put a LED for Probe and one for Pause or Dwell. These I will explain later. See the screen grab below as pic.

    Assigned the following macro to the "Auto Tool Zero" button.

    PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G4 P5" ' this delay gives me time to get from computer to hold probe in place
    Code "G31Z-40 F500" 'probing move, can set the feed rate here as well as how far to move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the axact point the probe was hit
    Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
    While IsMoving ()
    Wend
    Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G0 Z25.4" 'put the Z retract height you want here
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    Else
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Exit Sub
    End If

    EDIT: This is in metric. You will have to change some numbers if you still live in the Middle Ages. .......END EDIT

    Made a probe touch pad from a scrap of copper clad PCB material. See pic below.

    Conected to a spare input on my BOB. Mine needed a pull up resistor.

    Assigned it in "Ports and Pins" as "Probe" Set as "Active Low"

    The first one I made had a clip to go onto the tool. I found it worked faultlessly without it. So I ditched it. KISS

    Re, my screen changes.

    The "plate Thickness" DRO should be self explanatory.

    The Probe LED I made big so I could see it from the machine.

    My fear was that if an electrical fault happened and Mach did not stop the probe move then my spindle would drive on relentless. Causing mayhem.

    So I just touch the plate to the tool and see the LED light up, before running the macro to satisfy myself that all is good.

    The Pause LED just flashes during the 5 second pause I have set to give me time to get from computer to holding the plate in place.

    Now you can put these items (only the DRO if that's all you want) anywhere on the screen that suits you.

    I chose the area usually used for spindle control. Because I don't use it. YET!!!

    Now I will repeat, this is not my idea. Lots of people use this type of device

    I hope this inspires a few more to give this a try. Very useful on my type of machine. It really is easy.

    Greg



    hi, i have a problem.
    I got the standard mach3 screen with no auto too zero setup, jut the button.
    How can i make the same screen so i can use youre script?
    I use a 1.4 mm thick plate.
    Thanks!



  18. #558
    Registered
    Join Date
    Oct 2014
    Posts
    15
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    hi,
    i use the standard mach3 screen ( dont know how to change it)
    How cand i use youre scipt for mai auto zero plate o Z?
    i got olnly the auto zer tool button.
    Thanks



  19. #559
    Member
    Join Date
    Feb 2004
    Location
    Upper Black Eddy, PA
    Posts
    21
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Here's a Mach4 macro that was based on one of the scripts from this thread. Save it as "M231.mcs" in your Mach4hobby\profiles\"profilename"\macros folder.

    I wrote this in response to a question from Dave Sage on the mach1mach2cnc yahoo group.

    Code:
    --Macro to automatically zero the Z-axis using a contact plate of known thickness positioned
    --on top of the X-Y plane at the Z zero position. Cutting tool acts as a probe.
    --Last updated: 3/5/17
    --Author: Andy Wander. Adapted from the Mach3 macro by Christopher Esser (Smokingman). Based on the work done by Greolt
    function m231()
    
    -- this section sets user variables
        local ProbeDist = -1 --Set the maximum distance in inches to move the Z-axis before probe touches contact plate(must be negative).
        local ProbeFeed = 2 --Set the plunge speed for the probe in IPM
        local DelayTime = 1 --Set the delay time in seconds from probe verify to start of Z-motion
        local Retract = .1 --Set distance in inches to retract after probe
        local platethickness = 0.0625 --plate thickness in inches
        local VerifyTimeout = 10 --Set timeout to wait for probe verify in seconds
    -- new variables added 3/5/17 
        local Zreturn = 1 --set to 1 to have Z axis return to previous height after routine is run; set to 0 to have Z axis remain at Retract distance above probe point
        local Prompt = 1 --set to 1 to have the routine prompt you with a messagebox that requires clicking OK to continue befor probe starts; set to 0 to automatically start probe after touchplate verification
    
        local notify = wx.wxSound('C:\\Mach4Hobby\\Sounds\\Ding.wav',0) --sound file to use for notifications-YOU MUST COPY copy the desired sound file to mach4hobby\sounds directory
        local alert = wx.wxSound('C:\\Mach4Hobby\\Sounds\\Chord.wav',0) --sound file to use for alerts-YOU MUST COPY copy the desired sound file to mach4hobby\sounds directory
        local abort = wx.wxSound('C:\\Mach4Hobby\\Sounds\\Ringout.wav',0) --sound file to use for Abort-YOU MUST COPY copy the desired sound file to mach4hobby\sounds directory
        local success = wx.wxSound('C:\\Mach4Hobby\\Sounds\\Windows Print complete.wav',0) --sound file to use for Success-YOU MUST COPY copy the desired sound file to mach4hobby\sounds directory
    
    -- this section sets Mach4 variables
        local inst = mc.mcGetInstance()
        local hProbe = mc.mcSignalGetHandle(inst, mc.ISIG_PROBE)  --get handle of Input Signal for Probe activated
        local hSpindle = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON) --get handle of Output Signal for Spindle ON
        local cancel = 0 --set cancel signal to 0
        local verifyTimer = VerifyTimeout*1000 --set timeout in milliseconds
    
    -- this section records machine state variables
        local zstart = mc.mcAxisGetMachinePos(inst, 2) --save current Machine Z coordinate
        local curunits = mc.mcCntlGetPoundVar(inst, 4006) --save current units, feedrate, feedmode, abs/inc mode
        local curfeed = mc.mcCntlGetPoundVar(inst, 2134)
        local curfeedmode = mc.mcCntlGetPoundVar(inst, 4001)
        local curabsmode = mc.mcCntlGetPoundVar(inst, 4003)
    
    -- this section looks for a grounded touch plate
        if ( mc.mcSignalGetState(hProbe) == 1 ) then --Check to see if the probe is already grounded or faulty
            wx.wxMessageBox("Ground fault in probe detected. Fix probe and try again.") --tell user that probe is grounded, and exit function
            local error = "Ground Fault in Probe detected! "
            cancel = 1 --set cancel signal to 1
        else --if (answer == 2 or others)
            cancel = 0 --set cancel signal to 0
        end
            
     -- this section to prompt user if Spindle is on
       if ( cancel == 0 )  then --if a previous operation has not cancelled the routine
            if ( mc.mcSignalGetState(hSpindle) == 1 ) then--Check to see if the spindle is running
                notify:Play()--play a warning sound
                local answer = wx.wxMessageBox("It appears the spindle is running! Select 'Yes' to continue anyway or 'No' to exit.","" ,wx.wxYES +wx.wxNO)
                if (answer == 8) then       --if user cancels
                    error = "Spindle is ON! "
                    cancel = 1 --set cancel signal to 1
                else --if (answer == 2 or others)
                    cancel = 0 --set cancel signal to 0
                end 
            end    
        end
                    
    -- this section to prompt user to test touch plate
        if ( cancel == 0 ) then --if a previous operation has not cancelled the routine
            notify:Play()--play a warning sound
            mc.mcCntlSetLastError(inst, "Touch probe to tool within 10s to verify connection") --prompt for touchplate test
            while(verifyTimer >= 1) do
                wx.wxMilliSleep(100) --wait for 100 mS
                if ( mc.mcSignalGetState(hProbe) == 0 ) then   --look for probe signal
                    verifyTimer = (verifyTimer - 100) --decrement timer
                    cancel = 1 --set cancel signal to 1
                    error = "Probe verify timed out. Fix Probe and try again. "
                else
                    verifyTimer = 0  --zero timer
                    cancel = 0 --set cancel signal to 0
                end
            end
        end
    
    -- this section probes, sets Z coordinate, and restores machine to initial conditions
        if ( cancel == 0 ) then --if previous a operation has not cancelled the operation
            mc.mcCntlGcodeExecuteWait(inst, "G20")--Set Units to inches
            if Prompt == 1 then  --if the variable is set to 1
                wx.wxMessageBox("Please place the touchplate in position, and click OK to continue.") --prompt for touchplate placement
                notify:Play() --play a notification sound
                mc.mcCntlGcodeExecuteWait(inst, "G04 P"..(1000*DelayTime))  --wait for the Delay Time before probing
            elseif Prompt == 0 then --if prompt variable is 0
                alert:Play() --play an alert sound
                mc.mcCntlGcodeExecuteWait(inst, "G04 P"..(2000*DelayTime))  --wait for twice the Delay Time before probing
            end
            mc.mcCntlSetLastError(inst, "Probing for tool Z length!" )
            local probestartZ = mc.mcAxisGetMachinePos(inst, 2) --save Machine Z coordinate before probing
            mc.mcCntlGcodeExecuteWait(inst, "G20 G91 G31 z"..ProbeDist.." F"..ProbeFeed)--Probe for current tool length/position
            local probeendZ = mc.mcAxisGetMachinePos(inst, 2) --save Machine Z coordinate after probing
            local probeendZactual = mc.mcCntlGetPoundVar(inst, 5073) --get Z Machine coordinate of Actual Probe Position
            if ( ProbeDist < (probeendZactual - probestartZ)) then   --if probe moved less than max probe distance
                local correction = (probeendZactual-probeendZ) --calculate overshoot/correction)
                mc.mcAxisSetPos(inst, 2, (platethickness-correction))--set Z coord to thickness of plate - correction distance
                mc.mcCntlGcodeExecuteWait(inst, "G20 G91 G0 Z"..Retract)--Move the Z axis off the touchplate by Retract Distance
                success:Play()  --play the Success sound
                mc.mcCntlSetLastError(inst, "Probing Complete, Z Axis is Zeroed!")
            else
                mc.mcCntlSetLastError(inst, "Probe did not encounter touchplate. Auto Tool Zero Aborted!")
                abort:Play()  --play the Abort sound
            end
            mc.mcCntlGcodeExecuteWait(inst, "F"..curfeed) --set feedrate back to saved setting
            mc.mcCntlGcodeExecuteWait(inst, "G"..curunits)--set units back to saved setting from beginning
            if Zreturn == 1 then  --if Variable is set to 1
                mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z"..zstart)--move Z axis back to saved position in Machine coords
            end
            mc.mcCntlGcodeExecuteWait(inst, "G"..curfeedmode) --set feed mode back to saved setting
            mc.mcCntlGcodeExecuteWait(inst, "G"..curabsmode) --set abs mode back to saved setting
        else --if "cancel" == 1 then cancel Probing operation!
            abort:Play()  --play the Abort sound
            mc.mcCntlSetLastError(inst, error.."Auto Tool Zero Aborted!" )
            end
    end
    
    if (mc.mcInEditor() == 1) then
     m231()
    end


    Andy


  20. #560
    Member
    Join Date
    Aug 2017
    Location
    United Kingdom
    Posts
    0
    Downloads
    0
    Uploads
    0

    Default Re: Another Aussie Auto Tool Zero Setter

    Hello Greolt,

    Maybe you could help me, Been trying to set up the auto tool zero function within mach 3 for weeks but having no such luck!

    I'm very new to using this sort of CNC machine and any help is appreciated, Code we're currently using taken off this website but having no luck, Our touch plate is 6mm thick.

    Keep getting the same error regardless of what code I am using.


    (No characters found in reading real value, Block = F)


    PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

    If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G4 P5" ' this delay gives me time to get from computer to hold probe in place
    Code "G31Z-40 F500" 'probing move, can set the feed rate here as well as how far to move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the axact point the probe was hit
    Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
    While IsMoving ()
    Wend
    Call SetDro (2, PlateThickness) 'set the Z axis DRO to whatever is set as plate thickness
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G0 Z25.4" 'put the Z retract height you want here
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    Else
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Exit Sub
    End If




Page 28 of 29 FirstFirst ... 182526272829 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Another Aussie Auto Tool Zero Setter

Another Aussie Auto Tool Zero Setter