. .
Page 1 of 2 12 LastLast
  1. #1
    hoopy's Avatar
    Lives in falkirk, United Kingdom. Last Activity: 3 Weeks Ago Has been a member for 0-1 years. Has a total post count of 9.
    have installed a z axis probe for setting tool height on mach3 tested the connection under diagnostics and the digitise light flashes green to prove contact but when i hit auto tool zero nothing happens
    this is the script i got from the internet
    the only thing i adjusted was plate thickness to 1.57mm
    REM Updated 30 Aug 2018
    REM Auto Tool Zero Z- Metric 2 pass Version
    REM Based On the BigTex script
    REM (09 Feb 2018) Hint added To Material Thickness offset request box.
    REM (20 Feb 2018) Request To touch the touch the touchoff plate To the bit To start probing added. Thanks To Glen Higgs For this addition.
    REM (27 Jul 2018) Minor changes To Error Handling And Grammer correction
    REM (30 Aug 2018) Feedrate override safety Reset And restore added.

    PlateThickness = 19.86 'Enter Z-plate thickness here
    DownStroke = -100 'Set the down stroke to find probe
    DownFeedRate = 250 'Set the down FeedRate
    RetractStroke = 10 'Set the retract Stroke
    RetractFeedRate = 1000 'Set the retract FeedRate
    SmallRetractStroke = 1 'Retract 1mm for a 2nd pass
    SmallDownFeedRate = 25 'Set the slow down FeedRate for 2nd pass
    SmallDownStroke = -(SmallRetractStroke *2) 'Set down stroke for 2nd pass as twice the retract distance.
    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
    CurrentFeedOverride = GetOEMDRO(821)'Get current Feedrate override setting

    REM Request Material Thickness offset
    Offset = InputBox("Enter Material Thickness offset Hint: To probe from the Spoilboard surface, enter the nominal thickness of the material. Enter '0' or leave blank if probing from the material surface", "Material Offset", "")

    REM Touch plate To Cutter To Begin probe.
    message "Briefly touch the plate to the bit to start probing for zero."
    Touched_Flag = False
    count = 40
    seconds = 60
    For i = 1 To 600
    If GetOEMLed(825) <> 0 Then
    Beep
    Touched_Flag = True
    Exit For
    End If
    count = count - 1
    If count = 0 Then ' 1 second elapsed
    count = 40
    seconds = seconds -1
    End If
    Sleep 25
    Next i
    If Touched_Flag = False Then
    message "The Auto Zero timed out, no touch detected"
    Exit Sub
    End If

    REM 1st Pass at fast rate

    sleep 2000 'give time to remove block from tool and position
    REM Code "(Z axis 1st pass)" 'puts this message in the status bar
    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
    SetOEMDRO(821,100) 'Reset feedrate overide to 100% for safety
    Code "G90 G31 Z" &DownStroke &" F" &DownFeedRate 'probing move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the exact 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, 0) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G1 Z" &SmallRetractStroke &" F" &RetractFeedRate 'retract
    While IsMoving ()
    Wend
    REM Code "(Z axis 2nd pass)" 'puts this message in the status bar
    Else
    Rem 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
    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
    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

    REM 2nd pass at slow rate

    DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
    Code "G4 P1" ' this delay gives me time to get from computer to hold probe in place
    Code "G90 G31 Z" &SmallDownStroke &" F" &SmallDownFeedRate 'probing move
    While IsMoving() 'wait while it happens
    Wend
    ZProbePos = GetVar(2002) 'get the exact point the probe was hit
    If Abs(ZprobePos) <= Abs(SmallDownStroke)-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 - offset) 'set the Z axis DRO to whatever is set as plate thickness less the offset value
    Code "G4 P0.25" 'Pause for Dro to update.
    Code "G1 Z" &RetractStroke + PlateThickness &" 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 and try again)" 'puts this message in the status bar
    End If
    Code "F" &CurrentFeed 'Returns to prior feed rate
    SetOEMDRO(821,CurrentFeedOverride) 'Return feedrate override to previous value
    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

  2. #2
    How have you connected the macro code to the button? Did you edit the button definition?

  3. #3
    hoopy's Avatar
    Lives in falkirk, United Kingdom. Last Activity: 3 Weeks Ago Has been a member for 0-1 years. Has a total post count of 9.
    As new to this don't no what you mean im using mach3 did adjust input pins to for usb to port 1 and pin1 clicked on the tool button and entered script and saved it
    thank you for reply
    Last edited by hoopy; 27-10-2021 at 08:13 AM.

  4. #4
    hoopy this is what I posted a few weeks ago.

    In Mach 3 go to Operator down to edit button script click it then go to Auto tool Zero that should be flashing click on it and a Hidden script comes up copy what is in there and save.

    This is the code that was running my machine and my friends using a tool touch off plate, you will need to paste into the macro but put your own numbers in then save and shut down.

    To save any embarrassment put your touch plate on a block of wood say 50mm high touch off then move the block of wood to one side and "go to Zero" move block back under to check if it okay you might have to make some small adjustments to the figures.

    Hope it helps copy the below Phill

    'VB Code Start
    '-------------------
    CurrentFeed = GetOemDRO(818)
    DoSpinStop()

    ZMove = 100.00 'Total lenght of Probe to move before Stop or no Contact Made.
    ZOffset = 8.60 ' Plate Hight
    ZSal = ZOffset + 20.00 '+ Free Hight, Will possition the Proble 20 MM over the Material.

    StopZmove = 0
    If GetOemLed (825)=0 Then
    DoOEMButton (1010)
    Code "G4 P2.5"
    Code "G31 Z-"& ZMove & "F200"
    While IsMoving()
    Sleep(200)
    Wend
    Probepos = GetVar(2002)
    If Probepos = - ZMove Then
    responce = MsgBox ("**ERROR** " , 4 , "Probe **ERROR**" )
    Code "G0 Z10"
    StopZmove = 1
    Code "F" &CurrentFeed
    End If
    If StopZmove = 0 Then
    Code "G0 Z" & Probepos
    While IsMoving ()
    Sleep (200)
    Wend
    Call SetDro (2, ZOffset)
    Code "G4 P1"
    Code "G0 Z" & ZSal
    Code "(Z zeroed)"
    Code "F" &CurrentFeed
    End If
    Else
    Code "(Check Ground Probe)"
    End If
    Exit Sub
    '-------------------
    'VB Code Stop

  5. #5
    Wot he said!

    By default, Mach3 provides the button but doesn't have the code behind it. This is usually machine-dependent so there isn't a guaranteed one-size-fits-all piece of code. I suspect that most of the samples that you find on the net are variations are developments of the original and often get tweaked to suit individual requirements.

    Phill05 has given you the method of linking the code to the button; your code looks fine but has a few additional checks in it and either would work.

  6. #6
    hoopy's Avatar
    Lives in falkirk, United Kingdom. Last Activity: 3 Weeks Ago Has been a member for 0-1 years. Has a total post count of 9.
    Hi all tried that when pressing auto tool zero comes back saying (scripter compille error in) Where you have ZOffset = 8.60 ' Plate Hight in put in 1.57

  7. #7
    Can you double-check exactly what you put in? You could also try it as it stands (with the 8.60). Things to watch are comma not fullstop/decimal point, letter o not digit 0, letter I not digit 1, extra space in there somewhere it shouldn't be. I only say this because I'm pretty sure I've made all these errors over the years! A mis-type is sometimes difficult to spot.

    A useful trick when testing - put your height plate on a block of foam. This gives you the time to react and hit the e-stop if it all goes pear-shaped! For the same reason, for testing, I often use a bit of flat-ended rod (or even a tool in the collet the wrong way round) so you are more likely to stall the machine than drive a tool through the bed. Again, I am ashamed to say I speak from experience...

  8. #8
    hoopy's Avatar
    Lives in falkirk, United Kingdom. Last Activity: 3 Weeks Ago Has been a member for 0-1 years. Has a total post count of 9.
    here is code a put in
    VB Code Start
    '-------------------
    CurrentFeed = GetOemDRO(818)
    DoSpinStop()

    ZMove = 100.00 'Total lenght of Probe to move before Stop or no Contact Made.
    ZOffset = 1.57 ' Plate Hight
    ZSal = ZOffset + 20.00 '+ Free Hight, Will possition the Proble 20 MM over the Material.

    StopZmove = 0
    If GetOemLed (825)=0 Then
    DoOEMButton (1010)
    Code "G4 P2.5"
    Code "G31 Z-"& ZMove & "F200"
    While IsMoving()
    Sleep(200)
    Wend
    Probepos = GetVar(2002)
    If Probepos = - ZMove Then
    responce = MsgBox ("**ERROR** " , 4 , "Probe **ERROR**" )
    Code "G0 Z10"
    StopZmove = 1
    Code "F" &CurrentFeed
    End If
    If StopZmove = 0 Then
    Code "G0 Z" & Probepos
    While IsMoving ()
    Sleep (200)
    Wend
    Call SetDro (2, ZOffset)
    Code "G4 P1"
    Code "G0 Z" & ZSal
    Code "(Z zeroed)"
    Code "F" &CurrentFeed
    End If
    Else
    Code "(Check Ground Probe)"
    End If
    Exit Sub
    '-------------------
    'VB Code Stop

  9. #9
    hoopy's Avatar
    Lives in falkirk, United Kingdom. Last Activity: 3 Weeks Ago Has been a member for 0-1 years. Has a total post count of 9.
    Should digitize be perminatly be on as stated before should it be port3 for usb and on break out board using in 1 pin
    as light only goes out when i get contacts to touch then flashes

  10. #10
    Not sure what probe you are using but you need to go to "Config" "ports&pins" "input signals" scroll down to "probe" put green tick in you then need Port1 Pin 10 to 13 or15 your choice find pin no on board connect probe wires and test, you might have to go back in and select "active Low".

    Then proceed to putting code into hidden scrip macro as I stated above and it should be working and as Neale says make sure no typos or commas in wrong place.

    Just re read your last post, Not sure about your last comment "as stated before should it be port3 for usb and on break out board using in 1 pin" don't know where usb comes into this as you should be connecting to B out B.

    Phill

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Axis not working properly
    By Georgehun in forum Gantry/Router Machines & Building
    Replies: 13
    Last Post: 16-12-2020, 08:48 PM
  2. Replies: 3
    Last Post: 21-11-2019, 08:51 PM
  3. MPG has stopped working
    By CNCDev in forum CS-Lab (CSMIO)
    Replies: 2
    Last Post: 19-12-2018, 06:54 PM
  4. Z drive not working
    By whensparksfly in forum General Electronics
    Replies: 3
    Last Post: 14-04-2016, 09:14 PM
  5. x&z not working
    By cncjohn in forum Linear & Rotary Motion
    Replies: 5
    Last Post: 18-08-2013, 12:58 PM

Bookmarks

Posting Permissions

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