586,269 active members*
3,699 visitors online*
Register for free
Login
Page 8 of 21 67891018
Results 141 to 160 of 417
  1. #141
    Join Date
    Mar 2003
    Posts
    35538
    I have came across problem with my scripts and calc retract
    so I changed em to Code("G53G0Z-0.5") it is safer routine just in case something is in the way.
    It was rare situation but I felt like it needed changing.
    Are you homing at the top of Z and moving to .5 below the home switch?

    If so, that wouldn't work for me, as I have no Z Home Switch, and no repeatable Z reference point.

    Unless I'm reading it wrong??
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

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

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  2. #142
    Join Date
    Jul 2009
    Posts
    272
    This script will not proceed if you are not in working coordinates and makes it more "idiot proof". I guess work is progress improving functionality and preventing crashes.


    UPDATED TOOLCHANGE ZERO SETUP


    Option Explicit 'Written by Big-Tex May 25 2010
    Dim xjobcoord
    Dim yjobcoord
    Dim zjobcoord
    Dim xmachcoord
    Dim ymachcoord
    Dim zmachcoord
    Dim xprobeloc
    Dim yprobeloc
    Dim CurrentFeed
    Dim ZNew
    Dim ZPlate
    Dim Zplatetomaterial
    Dim PlateOffset
    Dim ZMaterialmachcoord
    Dim Zplatejobcoord
    Dim xtoprobe
    Dim ytoprobe

    xjobcoord = GetDRO(0) 'get current job coordinate for X
    yjobcoord = GetDRO(1) 'get current job coordinate for Y
    zjobcoord = GetDRO(2) 'get current job coordinate for Z

    xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
    ymachcoord = GetOemDRO(84) 'get current machine coordinate for y
    zmachcoord = GetOemDRO(85) 'get current machine coordinate for z

    xprobeloc = GetUserDRO(1100) 'get x machine coord of fixed plate
    yprobeloc = GetUserDRO(1101) 'get y machine coord of fixed plate

    xtoprobe = xprobeloc-xmachcoord+xjobcoord 'calc x move to fixed probe
    ytoprobe = yprobeloc-ymachcoord+yjobcoord 'calc y move to fixed probe

    Rem Move To fixed In Plate location
    If GetOemLED(16) Then 'Checks for machine coordinates
    Code "(Please change to working coordinates)" 'puts this message in the status bar
    Else


    If GetOemLed(801) Then 'check if Native Units are English
    If GetOemLED(825)<>0 Then

    Code "(Z-Plate Grounded Check connection and try again)" 'puts this message in the status bar
    Else

    Rem Probe In Z direction
    Code "G4 P0.25" 'pause for Dro to update.
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Code "G0X" &xtoprobe &"Y"& ytoprobe 'move to fixed plate location

    Rem Start Add lines To speed up

    Code "F12" 'slow down feedrate to 10 ipm
    Zplate = GetDro(2)-6 'probe move to current z - 6 inches
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" &Zplate+.1 'move back to hit point incase there was overshoot +.1 inches
    While IsMoving()
    Wend

    Rem End of add lines

    Code "F2" 'slow down feedrate to 2 ipm
    Zplate = GetDro(2)-.25 'probe move to current z - .25 inches
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.

    'ZNew = PlateOffset + 2.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-0.25")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord &"Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend

    Code "F350" '&CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update.
    Code "(Z axis is now zeroed in English Units)" 'puts this message in the status bar


    End If
    Else 'this portion of script is for Metric Native Units
    If GetOemLED(825)<>0 Then
    code "(Z-Plate Grounded Check connection and try again)" 'puts this message in the status bar
    Else

    Rem Probe In Z direction

    Code "G4 P0.25" 'pause for Dro to update.
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Code "G0X" &xtoprobe &"Y"& ytoprobe 'move to fixed plate location

    Rem Start Add lines To speed up

    Code "F300" 'slow down feedrate to 300 mmpm
    Zplate = GetDro(2)- 150 'probe move to current z - 150 mm
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" &Zplate+ 3 'move back to hit point incase there was overshoot + 3 mm
    While IsMoving()
    Wend

    Rem End of add lines

    Code "F50" 'slow down feedrate to 50 mmpm
    Zplate = GetDro(2)- 6 'probe move to current z - 6 mm
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.

    'ZNew = PlateOffset + 50 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-10")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord &"Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend

    Code "F" &CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update.
    Code "(Z axis is now zeroed in Metric Units)" 'puts this message in the status bar
    Code "F300"
    Sleep 100

    End If
    End If

    End If

    UPDATED INITIAL Z ZERO SETUP

    Option Explicit 'Written by Big-Tex May 25 2010
    Dim xjobcoord
    Dim yjobcoord
    Dim xmachcoord
    Dim ymachcoord
    Dim zmachcoord
    Dim xprobeloc
    Dim yprobeloc
    Dim xtoprobe
    Dim ytoprobe
    Dim PlateOffset
    Dim CurrentFeed
    Dim ZNew
    Dim Zplate
    Dim Zrestposition
    Dim ZMaterialmachcoord
    Dim ZPlatejobcoord
    Dim Zplatetomaterial

    xjobcoord = GetDRO(0) 'get current job coordinate for X
    yjobcoord = GetDRO(1) 'get current job coordinate for Y

    xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
    ymachcoord = GetOemDRO(84) 'get current machine coordinate for Y
    zmachcoord = GetOemDRO(85) 'get current machine coordinate for Z

    xprobeloc = GetUserDRO(1100) 'get X machine coordinate location of the touch plate
    yprobeloc = GetUserDRO(1101) 'get Y machine coordinate location of the touch plate

    xtoprobe = xprobeloc-xmachcoord+xjobcoord 'calculate the X move from the current location to the touch plate
    ytoprobe = yprobeloc-ymachcoord+yjobcoord 'calculate the Y move from the current location to the touch plate

    Rem VBScript To probe In the z axis
    If GetOemLED(16)<>0 Then 'Checks for machine coordinates
    code "(Please change to working coordinates)"
    Else

    If GetOemLED(801) Then 'check if English Units
    If GetOemLed (825) <> 0 Then 'check to see if the probe is already grounded or faulty
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Else
    Code "G4 P1" 'pause 1 seconds to give time to position probe plate
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later

    Rem Probe In the z direction

    Code "F10" 'slow down feedrate to 10 ipm
    ZNew = GetDro(2) - 6 'probe move to current z - 6 inches
    Code "G31Z" &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    ZNew = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZNew +.1 'move back to hit point incase there was overshoot +.1
    While IsMoving ()
    Wend

    Rem End add lines

    Code "F2" 'slow down feedrate to 2 ipm
    ZNew = GetDro(2) - .25 'probe move to current z - .25 inches
    Code "G31Z" &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    ZNew = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZNew 'move back to hit point incase there was overshoot
    While IsMoving ()
    Wend

    If PlateOffset <> 0 Then
    Call SetDro (2, PlateOffset) 'set the Z axis DRO to plate thickness
    Code "G4 P0.25" 'pause for Dro to update.
    'ZNew = PlateOffset + 3.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-0.25")
    While IsMoving ()
    Wend

    End If

    End If


    Rem VBScript To probe In the z axis

    If GetOemLed (825) <> 0 Then 'check to see if the probe is already grounded or faulty
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Else

    Rem Probe In the z direction
    Code "G4 P0.25" 'pause for Dro to update.
    Zrestposition = GetDro(2) 'get the job cooridnate of the Z axis after setting Z
    ZMaterialmachcoord = GetOemDRO(85)-ZNew 'get current machine coordinate for Z & calc the top of the material for use later
    Code "G4 P1" 'pause for Dro to update
    Code "G0X" &xtoprobe &"Y" &Ytoprobe 'rapid to the location of the plate

    Rem Start Add lines To speed this up

    Code "F10" 'slow down feedrate to 10 ipm
    ZPlate = GetDro(2) - 6 'probe move to current z - 6 inches
    Code "G31Z" &ZPlate
    While IsMoving() 'wait for probe move to finish
    Wend

    ZPlate = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZPlate +.1 'move back to hit point incase there was overshoot+.1
    While IsMoving ()
    Wend

    Rem End add lines

    Code "F2" 'slow down feedrate to 2 ipm
    ZPlate = GetDro(2) - .25 'probe move to current z - .25 inches
    Code "G31Z" &ZPlate
    While IsMoving() 'wait for probe move to finish
    Wend

    ZPlate = GetVar(2002) 'read the touch point
    Code "G1 Z" &ZPlate 'move back to hit point incase there was overshoot
    While IsMoving ()
    Wend

    Zplatetomaterial = GetDRO(2) 'record the current coordinate of the bottom of the tool and plate
    Call SetUserDRO(1102,Zplatetomaterial) 'this sets a user DRO to the value of the top of material to top of plate
    Code "G4 P0.25" 'pause for Dro to update.

    'ZNew = PlateOffset + 3.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-0.25")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord & "Y" & yjobcoord'returns to the previus X Y job location
    While IsMoving()
    Wend

    Code "F" &CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update
    Code "(Material Offset is Now Calculated in English Units)"'puts this message in the status bar

    End If
    Else 'this portion of script is for Metric Native Units
    If GetOemLed (825) <> 0 Then 'check to see if the probe is already grounded or faulty
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Else
    Code "G4 P1" 'pause 1 seconds to give time to position probe plate
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later

    Rem Probe In the z direction

    Code "F300" 'slow down feedrate to 300 mmpm
    ZNew = GetDro(2) - 150 'probe move to current z - 150 mm
    Code "G31Z" &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    ZNew = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZNew + 3 'move back to hit point incase there was overshoot + 3
    While IsMoving ()
    Wend

    Rem End add lines

    Code "F50" 'slow down feedrate to 50 mmpm
    ZNew = GetDro(2) - 6 'probe move to current z - 6 mm
    Code "G31Z" &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    ZNew = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZNew 'move back to hit point incase there was overshoot
    While IsMoving ()
    Wend

    If PlateOffset <> 0 Then
    Call SetDro (2, PlateOffset) 'set the Z axis DRO to plate thickness
    Code "G4 P0.25" 'pause for Dro to update.
    'ZNew = PlateOffset + 50 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-10")
    While IsMoving ()
    Wend

    End If

    End If


    Rem VBScript To probe In the z axis

    If GetOemLed (825) <> 0 Then 'check to see if the probe is already grounded or faulty
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Else

    Rem Probe In the z direction
    Code "G4 P0.25" 'pause for Dro to update.
    Zrestposition = GetDro(2) 'get the job cooridnate of the Z axis after setting Z
    ZMaterialmachcoord = GetOemDRO(85)-ZNew 'get current machine coordinate for Z & calc the top of the material for use later
    Code "G4 P1" 'pause for Dro to update
    Code "G0X" &xtoprobe &"Y" &Ytoprobe 'rapid to the location of the plate

    Rem Start Add lines To speed this up

    Code "F300" 'slow down feedrate to 300 mmpm
    ZPlate = GetDro(2) - 150 'probe move to current z - 150 mm
    Code "G31Z" &ZPlate
    While IsMoving() 'wait for probe move to finish
    Wend

    ZPlate = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZPlate + 3 'move back to hit point incase there was overshoot+3
    While IsMoving ()
    Wend

    Rem End add lines

    Code "F50" 'slow down feedrate to 50 mmpm
    ZPlate = GetDro(2) - 6 'probe move to current z - 6 mm
    Code "G31Z" &ZPlate
    While IsMoving() 'wait for probe move to finish
    Wend

    ZPlate = GetVar(2002) 'read the touch point
    Code "G1 Z" &ZPlate 'move back to hit point incase there was overshoot
    While IsMoving ()
    Wend

    Zplatetomaterial = GetDRO(2) 'record the current coordinate of the bottom of the tool and plate
    Call SetUserDRO(1102,Zplatetomaterial) 'this sets a user DRO to the value of the top of material to top of plate
    Code "G4 P0.25" 'Pause for Dro to update.
    'ZNew = PlateOffset + 50 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-10")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord & "Y" & yjobcoord'returns to the previus X Y job location
    While IsMoving()
    Wend

    Code "F" &CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update
    Code "(Material Offset is Now Calculated in Metric Units)"'puts this message in the status bar
    Code "F200"
    Sleep 100


    End If
    End If
    End If

  3. #143
    Join Date
    Jul 2009
    Posts
    272
    Quote Originally Posted by ger21 View Post
    Are you homing at the top of Z and moving to .5 below the home switch?

    If so, that wouldn't work for me, as I have no Z Home Switch, and no repeatable Z reference point.

    Unless I'm reading it wrong??
    You are correct.
    This will work if you have Z home switch.
    I have home switches on all 3 axis and works for me.

  4. #144
    Join Date
    Jul 2009
    Posts
    272
    UPDATED TOOL CHANGE ZERO SETUP SCRIPT
    Option Explicit 'Written by Big-Tex November 29 2010
    Dim xjobcoord
    Dim yjobcoord
    Dim zjobcoord
    Dim xmachcoord
    Dim ymachcoord
    Dim zmachcoord
    Dim xprobeloc
    Dim yprobeloc
    Dim CurrentFeed
    Dim ZNew
    Dim ZPlate
    Dim Zplatetomaterial
    Dim PlateOffset
    Dim ZMaterialmachcoord
    Dim Zplatejobcoord
    Dim xtoprobe
    Dim ytoprobe

    xjobcoord = GetDRO(0) 'get current job coordinate for X
    yjobcoord = GetDRO(1) 'get current job coordinate for Y
    zjobcoord = GetDRO(2) 'get current job coordinate for Z

    xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
    ymachcoord = GetOemDRO(84) 'get current machine coordinate for y
    zmachcoord = GetOemDRO(85) 'get current machine coordinate for z

    xprobeloc = GetUserDRO(1100) 'get x machine coord of fixed plate
    yprobeloc = GetUserDRO(1101) 'get y machine coord of fixed plate

    xtoprobe = xprobeloc-xmachcoord+xjobcoord 'calc x move to fixed probe
    ytoprobe = yprobeloc-ymachcoord+yjobcoord 'calc y move to fixed probe

    Rem Move To fixed In Plate location
    If GetOemLED(16)<>0 Then 'Checks for machine coordinates
    code "(Please change to working coordinates)"
    Else


    If GetOemLed(801) Then 'check if Native Units are English
    If GetOemLED(825)<>0 Then

    code "(Z-Plate Grounded Check connection and try again)"
    Else

    Rem Probe In Z direction

    Code "G4 P0.25" 'pause for Dro to update.
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Code "G0X" &xtoprobe &"Y"& ytoprobe 'move to fixed plate location

    Rem Start Add lines To speed up

    Code "F12" 'slow down feedrate to 10 ipm
    Zplate = GetDro(2)-6 'probe move to current z - 6 inches
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" &Zplate+.1 'move back to hit point incase there was overshoot +.1 inches
    While IsMoving()
    Wend

    Rem End of add lines

    Code "F2" 'slow down feedrate to 2 ipm
    Zplate = GetDro(2)-.25 'probe move to current z - .25 inches
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.

    'ZNew = PlateOffset + 2.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-0.25")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord &"Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend

    Code "F350" '&CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update.
    Code "(Z axis is now zeroed in English Units)" 'puts this message in the status bar

    While IsMoving() 'wait for returing to tool change location
    Wend
    Code DoButton(0) 'Cycle Start

    End If
    Else 'this portion of script is for Metric Native Units
    If GetOemLED(825)<>0 Then
    code "(Z-Plate Grounded Check connection and try again)"
    Else

    Rem Probe In Z direction

    Code "G4 P0.25" 'pause for Dro to update.
    CurrentFeed = GetOemDRO(818) 'get the current feedrate to return to later
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Code "G0X" &xtoprobe &"Y"& ytoprobe 'move to fixed plate location

    Rem Start Add lines To speed up

    Code "F300" 'slow down feedrate to 300 mmpm
    Zplate = GetDro(2)- 150 'probe move to current z - 150 mm
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" &Zplate+ 3 'move back to hit point incase there was overshoot + 3 mm
    While IsMoving()
    Wend

    Rem End of add lines

    Code "F50" 'slow down feedrate to 50 mmpm
    Zplate = GetDro(2)- 6 'probe move to current z - 6 mm
    Code "G31Z" &Zplate
    While IsMoving()
    Wend

    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Code "G4 P0.25" 'pause for Dro to update.

    'ZNew = PlateOffset + 50 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53G0Z-10")
    While IsMoving () 'wait for probe move to finish retracting
    Wend

    Code "G0X" & xjobcoord &"Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend

    Code "F" &CurrentFeed 'returns to prior feed rate
    Code "G4 P0.25" 'pause for Dro to update.
    Code "(Z axis is now zeroed in Metric Units)" 'puts this message in the status bar

    While IsMoving() 'wait for returing to tool change location
    Wend
    Code DoButton(0) 'Cycle Start



    End If

    End If
    End If

  5. #145
    Join Date
    Jul 2009
    Posts
    272
    Installer version will be posted soon with list of fixed issues.

  6. #146
    Join Date
    Jan 2008
    Posts
    932
    I am liking the whole idea behind this z setter. Will make things run smoother for me.

    Will have to fiddle with my CAM program to see how to set it up so it starts a 'tool change'. But that should be easy enough.

    I wonder about the folks that had issues with the bit occasionally touching off then driving down into the plate. I had that issue with the routines I was using a while ago. Was that resolved in this code?

    Greolt looked at my code recently and said it was an issue with the G90/G91 state, so he modified the code to get the current state at the start, then use G90 for probing, then at the end shift the state back to what it originally was. Just curious if perhaps the same thing happened to the other guys was caused due to the same thing.

  7. #147
    Join Date
    Jul 2009
    Posts
    272
    Post the code here so others with same problems can benefit as well.
    I will test it as well. What Cad/Cam do you use?

  8. #148
    Join Date
    Jan 2008
    Posts
    932
    Here is what I was running, the bold is the new parts to handle the 90/91 setting...


    CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
    CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
    PlateOffset = GetUserDRO(1151) 'Get plate offset DRO
    If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty
    Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if aplicable
    Else

    Code "F4" 'slow down feedrate to 4 ipm
    Code "G4 P1" 'Pause 1 seconds to give time to position probe plate
    ZNew = GetDro(2) - 2 'probe move to current z - 2 inches
    Code "G90 G31Z " &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    ZNew = GetVar(2002) 'read the touch point
    Code "G0 Z" &ZNew 'move back to hit point incase there was overshoot
    While IsMoving ()
    Wend

    If PlateOffset <> 0 Then
    Call SetDro (2, PlateOffset) 'set the Z axis DRO to plate thickness
    Sleep 200 'Pause for Dro to update.
    ZNew = PlateOffset + .25
    Code "G0 Z" &ZNew 'put the Z retract height you want here
    While IsMoving ()
    Wend
    Code "(Z axis is now zeroed)" 'puts this message in the status bar
    End If
    If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
    Code "G91"
    End If

    Code "F" &CurrentFeed 'Returns to prior feed rate
    End If
    Forward Message

  9. #149
    Join Date
    Jul 2009
    Posts
    272
    thx

    excellent input

    I do appreciate people input ideas and improvements.

  10. #150
    Join Date
    May 2006
    Posts
    1469
    Arbo forgot to highlight the most important part of the changes I suggested

    Code "F4" 'slow down feedrate to 4 ipm
    Code "G4 P1" 'Pause 1 seconds to give time to position probe plate
    ZNew = GetDro(2) - 2 'probe move to current z - 2 inches
    Code "G90 G31Z " &ZNew
    While IsMoving() 'wait for probe move to finish
    Wend

    On the off chance the script was run when in a G91 state it would do unpredictable things. Not good.

    Greg

  11. #151
    Join Date
    Feb 2005
    Posts
    487
    Big-Tex,

    What does this mean and what is it for?
    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Does the user set this dro? I didn't see where you set it in your code.
    just curios, I suspect I am missing something..... perhaps you would clairify?

    also, I see you are flipping between G 90/91 type stuff, why dont you run the probing code
    in G53? then flip back to the users G90 or 91 at the end of the probe, just curious.

    Scott
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/

  12. #152
    Join Date
    Feb 2009
    Posts
    2143
    I am very interested in this piece of code. The latest version I can see was posted 12JUL2010 as version 3.1. Is there a new version, or is on imminent with the changes that have been recently discussed/posted in this thread?

    Big-tex - are you accepting donations/payment for the work you have done? If it would help to get an new "current" revision, I would be happy to pay you some amount...

  13. #153
    Join Date
    Mar 2003
    Posts
    35538
    What does this mean and what is it for?
    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset
    Does the user set this dro? I didn't see where you set it in your code.
    There are two different routines. The DRO gets set during the first one, and gets used for subsequent tool changes.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

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

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  14. #154
    Join Date
    Feb 2005
    Posts
    487
    Hey Big-Tex, I redid your code to make it smaller, and easier for you to edit, added Greolts and Arbo's changes:

    Sub Main() 'made it a sub, so you can return on "show stopper" errors

    'UPDATED TOOL CHANGE ZERO SETUP SCRIPT
    Option Explicit 'Written by Big-Tex November 29 2010
    'MODIFIED: by Poppa Bear, added Greolt's and Arbo's changes 08Dec2010

    Dim xjobcoord, yjobcoord, zjobcoord, xmachcoord, ymachcoord, zmachcoord
    Dim ZNew, ZPlate, Zplatetomaterial,PlateOffset, ZMaterialmachcoord, Zplatejobcoord
    Dim xprobeloc, yprobeloc,xtoprobe, ytoprobe
    Dim FirstProbeDist, FirstRetractDist, SecProbeDist
    Dim CurrentFeed
    Dim CurrentAbsInc

    xjobcoord = GetDRO(0) 'get current job coordinate for X
    yjobcoord = GetDRO(1) 'get current job coordinate for Y
    zjobcoord = GetDRO(2) 'get current job coordinate for Z
    xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
    ymachcoord = GetOemDRO(84) 'get current machine coordinate for y
    zmachcoord = GetOemDRO(85) 'get current machine coordinate for z
    xprobeloc = GetUserDRO(1100) 'get x machine coord of fixed plate
    yprobeloc = GetUserDRO(1101) 'get y machine coord of fixed plate
    xtoprobe = (xprobeloc - xmachcoord + xjobcoord) 'calc x move to fixed probe
    ytoprobe = (yprobeloc - ymachcoord + yjobcoord) 'calc y move to fixed probe
    CurrentFeed = = GetOemDro(818) 'get current feed rate
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset from somewhere else?
    CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state


    '//////// the block below will set all your reusable vars depending on Inch or mm.
    '//////// this sets the vars so you only need ONE large block of probing code.

    If GetOEMLED(801) Then 'ON = English Measure INCH
    FirstProbeDist = -6.0 'first probe travel
    FirstRetractDist = 0.1 'first probe retract travel
    SecProbeDist = -0.25 'second probe travel
    FirstProbeFeed = 12 'First Probe Feed Speed
    SecondProbeFeed = 2 'Second Probe Feed Speed
    Else 'OFF = Metric Measure MM
    FirstProbeDist = -150.0 'first probe travel
    FirstRetractDist = 3.0 'first probe retract travel
    SecProbeDist = -6.0 'second probe travel
    FirstProbeFeed = 300 'First Probe Feed Speed
    SecondProbeFeed = 50 'Second Probe Feed Speed
    End If

    '//////// Error Condition checking code

    If GetOemLED(16)<>0 Then 'Checks for machine coordinates
    Code "(Please change to working coordinates)"
    Exit Sub 'ERROR! exit the macro
    End If

    If GetOemLED(825)<>0 Then
    Code "(Z-Plate Grounded Check connection and try again)"
    Exit Sub 'ERROR! exit the macro
    End If

    '//////// Start Probing Code, Probe In -Z direction.
    '//////// The vars will be Inch or Metric from above if/else statment

    Code "G0 X" & xtoprobe & " Y" & ytoprobe 'move to fixed plate location
    Code "F" & FirstProbeFeed 'slow down feedrate to 12 ipm, or 300 mmpm
    Zplate = (GetDro(2) - FirstProbeDist) 'probe move to z - 6", or 150mm
    Code "G90 G31Z" & Zplate 'FIRST Probe Operation!
    While IsMoving()
    Wend
    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" & (Zplate + FirstRetractDist) 'retract above hit point +0.1" or +3mm
    While IsMoving()
    Wend
    Code "F" & SecondProbeFeed 'slow down feedrate to 2 ipm, or 50 mmpm
    Zplate = (GetDro(2)- SecProbeDist) 'probe move to current z - 0.25", or -6.0mm
    Code "G90 G31Z" & Zplate 'SECOND Probe Operation!
    While IsMoving()
    Wend
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Sleep(250) 'pause for Dro to update.
    'ZNew = PlateOffset + 2.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code("G53 G0 Z") & SecProbeDist
    While IsMoving () 'wait for probe move to finish retracting
    Wend
    Code "G0 X" & xjobcoord & "Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend
    Code "F" & CurrentFeed 'returns to prior feed rate

    If GetOEMLED(801) Then 'ON = English Measure INCH
    Code "(Z axis is now zeroed in English Units)" 'puts this message in the status bar
    Else 'OFF = Metric Measure MM
    Code "(Z axis is now zeroed in Metric Units)" 'puts this message in the status bar
    End If

    If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
    Code "G91"
    End If

    Code DoButton(0) 'Cycle Start

    End Sub
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/

  15. #155
    Join Date
    Feb 2009
    Posts
    2143
    Alternatively, can someone post some "baby steps" for my to explain how to get this working right in it's most current version? I can likely figure it out on my own if need be, but a cheat-sheet to get me started would be greatly appreciated...

  16. #156
    Join Date
    Mar 2003
    Posts
    35538
    If you run the last installer Big Tex posted, it should work right out of the box. The updated code may not be needed, and in some cases may not work, depending on your configuration.

    If you watch the video, it shows how it works.
    First, you need to auto zero plates. One moveable one, and one in a permanent fixed position on your machine.

    First step is to place the loose plate on your workpiece, and jog over it. There's a DRO on the Mach Blue screen for the plate thickness. Enter the thickness into the DRO.

    There are two other DRO's for the X and Y location of the fixed plate. Enter those as well.

    First, you run the initial Auto Zero routine.

    This moves to the plate, and sets Z= 0 to the top of your workpiece. Then, it moves to the fixed plate, measures the difference between that plate and Z-0, and writes it to another DRO on the screen.

    Now you can start cutting. When you get to a tool change, you stop and change the tool.

    Then, you run the other Auto zero routine, which goes to the fixed plate and touches it. It then uses the pre calculated offset to set the Z= 0 to the top of your workpiece. Then you press cycle start and continue cutting with the new tool. For more tool changes, just run the second macro again.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

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

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  17. #157
    Join Date
    Mar 2003
    Posts
    35538
    Scott, there are a few bugs in the code you posted. Don't have time to go through it thoroughly, but real quick.

    Option Explicit gives an error

    Two ==
    CurrentFeed = = GetOemDro(818) 'get current feed rate

    Should be 6, not -6. This makes it probe up.
    FirstProbeDist = -6.0 'first probe travel
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

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

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  18. #158
    Join Date
    Feb 2005
    Posts
    487
    Yes the double equals is a coping mistake, when I was coping and moving aorund code blocks....... the minus six, in looking at his code the first probe is z down move, so I put the minus since his first probe move was a downward probe.

    The typos are only copy errors, and if the probing numbers are the wrong direction they can easily be edited at the top block of code.....

    The purpose was to make his code more efficient and smaller, thus easier to edit/change.
    Option Explicit........ I never use option explicit, since it does cause bugs, just comment it out if you want...... I just put it there cause he had it there.

    scott
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/

  19. #159
    Join Date
    Mar 2003
    Posts
    35538
    Not complaining, just pointing out that it didn't work.

    It's greatly appreciated, as it really is much cleaner and simpler.

    The -6 doesn't work because he's subtracting 6in to get the probe depth.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

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

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  20. #160
    Join Date
    Feb 2005
    Posts
    487
    ok, here it is again, I fixed the ==, and changed the - value first probe, and second probe to positive numbers since his, math formula makes it a negative.
    also commented out the "Option Explicit", since I did not data type the Dim vars...... so, it runs now..... sorry about the inconvienance.

    here it is:

    Sub Main() 'made it a sub, so you can return on "show stopper" errors

    'UPDATED TOOL CHANGE ZERO SETUP SCRIPT
    'Option Explicit
    'Written by Big-Tex November 29 2010
    'Modified by Poppa Bear, added Greolt's and Arbo's changes 08Dec2010

    Dim xjobcoord, yjobcoord, zjobcoord, xmachcoord, ymachcoord, zmachcoord
    Dim ZNew, ZPlate, Zplatetomaterial,PlateOffset, ZMaterialmachcoord, Zplatejobcoord
    Dim xprobeloc, yprobeloc,xtoprobe, ytoprobe
    Dim FirstProbeDist, FirstRetractDist, SecProbeDist
    Dim CurrentFeed
    Dim CurrentAbsInc

    xjobcoord = GetDRO(0) 'get current job coordinate for X
    yjobcoord = GetDRO(1) 'get current job coordinate for Y
    zjobcoord = GetDRO(2) 'get current job coordinate for Z
    xmachcoord = GetOemDRO(83) 'get current machine coordinate for X
    ymachcoord = GetOemDRO(84) 'get current machine coordinate for y
    zmachcoord = GetOemDRO(85) 'get current machine coordinate for z
    xprobeloc = GetUserDRO(1100) 'get x machine coord of fixed plate
    yprobeloc = GetUserDRO(1101) 'get y machine coord of fixed plate
    xtoprobe = (xprobeloc - xmachcoord + xjobcoord) 'calc x move to fixed probe
    ytoprobe = (yprobeloc - ymachcoord + yjobcoord) 'calc y move to fixed probe
    CurrentFeed = GetOemDro(818) 'get current feed rate
    PlateOffset = GetUserDRO(1151) 'get plate offset DRO
    Zplatetomaterial = GetUserDRO(1102) 'get calculated material offset from somewhere else?
    CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state


    '//////// the block below will set all your reusable vars depending on Inch or mm.
    '//////// this sets the vars so you only need ONE large block of probing code.

    If GetOEMLED(801) Then 'ON = English Measure INCH
    FirstProbeDist = 6.0 'first probe travel
    FirstRetractDist = 0.1 'first probe retract travel
    SecProbeDist = 0.25 'second probe travel
    FirstProbeFeed = 12 'First Probe Feed Speed
    SecondProbeFeed = 2 'Second Probe Feed Speed
    Else 'OFF = Metric Measure MM
    FirstProbeDist = 150.0 'first probe travel
    FirstRetractDist = 3.0 'first probe retract travel
    SecProbeDist = 6.0 'second probe travel
    FirstProbeFeed = 300 'First Probe Feed Speed
    SecondProbeFeed = 50 'Second Probe Feed Speed
    End If

    '//////// Error Condition checking code

    If GetOemLED(16)<>0 Then 'Checks for machine coordinates
    Code "(Please change to working coordinates)"
    Exit Sub 'ERROR! exit the macro
    End If

    If GetOemLED(825)<>0 Then
    Code "(Z-Plate Grounded Check connection and try again)"
    Exit Sub 'ERROR! exit the macro
    End If

    '//////// Start Probing Code, Probe In -Z direction.
    '//////// The vars will be Inch or Metric from above if/else statment

    Code "G0 X" & xtoprobe & " Y" & ytoprobe 'move to fixed plate location
    Code "F" & FirstProbeFeed 'slow down feedrate to 12 ipm, or 300 mmpm
    Zplate = (GetDro(2) - FirstProbeDist) 'probe move to z - 6", or 150mm
    Code "G90 G31Z" & Zplate 'FIRST Probe Operation!
    While IsMoving()
    Wend
    Zplate = GetVar(2002) 'read the touch point
    Code "G1 Z" & (Zplate + FirstRetractDist) 'retract above hit point +0.1" or +3mm
    While IsMoving()
    Wend
    Code "F" & SecondProbeFeed 'slow down feedrate to 2 ipm, or 50 mmpm
    Zplate = (GetDro(2)- SecProbeDist) 'probe move to current z - 0.25", or -6.0mm
    Code "G90 G31Z" & Zplate 'SECOND Probe Operation!
    While IsMoving()
    Wend
    Call SetDRO(2,Zplatetomaterial) 'this sets Z DRO to calculated material offset
    Sleep(250) 'pause for Dro to update.
    'ZNew = PlateOffset + 2.6315 'calc retract
    'Code "G0 Z" &ZNew 'put the Z retract height you want here
    Code "G53 G0 Z" & SecProbeDist
    While IsMoving () 'wait for probe move to finish retracting
    Wend
    Code "G0 X" & xjobcoord & "Y" & yjobcoord 'returns to the previous X Y job location
    While IsMoving()
    Wend
    Code "F" & CurrentFeed 'returns to prior feed rate

    If GetOEMLED(801) Then 'ON = English Measure INCH
    Code "(Z axis is now zeroed in English Units)" 'puts this message in the status bar
    Else 'OFF = Metric Measure MM
    Code "(Z axis is now zeroed in Metric Units)" 'puts this message in the status bar
    End If

    If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
    Code "G91"
    End If

    Code DoButton(0) 'Cycle Start

    End Sub
    Commercial Mach3: Screens, Wizards, Plugins, Brains,PLCs, Macros, ATC's, machine design/build, retrofit, EMC2, Prototyping. http://sites.google.com/site/volunteerfablab/

Page 8 of 21 67891018

Similar Threads

  1. Replies: 1
    Last Post: 03-04-2014, 01:08 AM
  2. Tool Length Offset Tool Setter
    By CNCneeds in forum News Announcements
    Replies: 0
    Last Post: 01-03-2014, 06:27 PM
  3. Tool Setter Macro for M-V60C and Metrol Setter
    By mitshack in forum Mazak, Mitsubishi, Mazatrol
    Replies: 1
    Last Post: 02-02-2013, 12:08 PM
  4. Okuma Tool Setter Reference Tool
    By lisaclisac in forum Okuma
    Replies: 7
    Last Post: 09-28-2012, 03:21 PM
  5. Tool setter macro for M-V60C and Metrol setter
    By mitshack in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 10-06-2008, 02:38 PM

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
  •