587,187 active members*
5,735 visitors online*
Register for free
Login
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    90

    How do you tell a macro to wait?

    Hi guys,

    I'm using a tool change macro that, when called, goes to X0 Y0. It pauses there for 5 seconds, and then starts lowering the Z slowly while looking for an input from a touch-off. Once it reads a touch-off, it zeros the Z axis and raises it to .3, then returns to the position it was at when the tool change was called.The problem is that once it gets to X0 Y0, I'd like it to wait for me to manually switch out the tool and hit Cycle Start to go to the tool zeroing portion of the macro. I have tried entering Code "M1", but that has no effect. The macro appears below. I would like to add the command to wait for input from me in the area where I've posted the comment in all caps (before the Tool Zero Macro). Can anyone tell me what I'm doing wrong here?

    'ToolChange Macro
    Sub Main()
    OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
    x = GetToolChangeStart( 0 )
    y = GetToolChangeStart( 1 )
    z = GetToolChangeStart( 2 )
    a = GetToolChangeStart( 3 )
    b = GetToolChangeStart( 4 )
    c = GetToolChangeStart( 5 )
    tool = GetSelectedTool()
    NewTool = tool
    'Tool Changer Macro
    MaxToolNum = 40 'Max number of tools for the changer
    If NewTool = OldTool Then
    Exit Sub
    End If
    While NewTool > MaxToolNum
    NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
    Wend
    Code "G00 G53 Z0.0" 'Absolute positioning (machine coords) to Z home
    While IsMoving()
    Wend
    Code "G00 G53 X0.00 Y0.00" 'G53 added to this line to select absolute positioning for X and Y too by Ian
    While IsMoving()
    Wend
    Code "G4 P5.0" 'Pause for actual tool change out
    'HOW CAN I ADD A COMMAND HERE TO WAIT UNTIL THE CYCLE START BUTTON IS PUSHED BEFORE PROCEEDING?
    While IsMoving()
    Wend









    'Begin tool zero macro here

    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.0" ' this delay gives me time to get from computer to hold probe in place
    Code "G40" 'Ian is testing this
    Code "G31Z-2 F5" '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 exact 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 Z.3" '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

    'End of tool length macro here

    Call SetUserDRO (1200,NewTool)
    SetCurrentTool( NewTool )
    Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
    End Sub

    Main
    'Soft limits will trip if turned on and the probe move is not allowed to move below -.3 (in machine coords). This will mess up process, since the retract in Tool Zero Macro retracts .3 inches.

  2. #2
    Join Date
    Jan 2008
    Posts
    48
    M1 is optional program stop, is the control set to look for the M1? Did you try M0?

  3. #3
    Join Date
    Oct 2006
    Posts
    90
    Good question. Yes the M1 box is checked, and will work if I command an M1 stop in the g code itself or from the MDI. M0 doesn't work in the macro either. Here is the way that I am calling the M1 code (look for the lines followed by 'AAAAAAAAAA). Is the proper way to call those codes?

    'ToolChange Macro
    Sub Main()
    OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
    x = GetToolChangeStart( 0 )
    y = GetToolChangeStart( 1 )
    z = GetToolChangeStart( 2 )
    a = GetToolChangeStart( 3 )
    b = GetToolChangeStart( 4 )
    c = GetToolChangeStart( 5 )
    tool = GetSelectedTool()
    NewTool = tool
    'Tool Changer Macro
    MaxToolNum = 40 'Max number of tools for the changer
    If NewTool = OldTool Then
    Exit Sub
    End If
    While NewTool > MaxToolNum
    NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
    Wend
    Code "G00 G53 Z0.0" 'Absolute positioning (machine coords) to Z home
    While IsMoving()
    Wend
    Code "G00 G53 X0.00 Y0.00" 'G53 added to this line to select absolute positioning for X and Y too by Ian
    While IsMoving()
    Wend
    Code "G4 P5.0" 'Pause for actual tool change out HOW CAN I ADD A COMMAND HERE TO WAIT UNTIL THE CYCLE START BUTTON IS PUSHED BEFORE PROCEEDING?
    While IsMoving()
    Wend

    Code "M1" 'AAAAAAAAAAAAAAA
    While IsMoving() 'AAAAAAAAAAAAAAAA
    Wend 'AAAAAAAAAAAAAAAAA







    'Begin tool zero macro here

    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.0" ' this delay gives me time to get from computer to hold probe in place
    Code "G40" 'Ian is testing this
    Code "G31Z-2 F5" '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 exact 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 Z.3" '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

    'End of tool length macro here

    Call SetUserDRO (1200,NewTool)
    SetCurrentTool( NewTool )
    Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
    End Sub

    Main
    'Soft limits will trip if turned on and the probe move is not allowed to move below -.3 (in machine coords). This will mess up process, since the retract in Tool Zero Macro retracts .3 inches.

Similar Threads

  1. how to pause mach 3 to wait for an input from pasma
    By bthomps5 in forum Mach Software (ArtSoft software)
    Replies: 2
    Last Post: 09-01-2008, 05:44 AM
  2. can't wait
    By clammy23 in forum Commercial CNC Wood Routers
    Replies: 3
    Last Post: 03-03-2008, 01:16 AM
  3. Boss5 Wait and Hold Led light
    By frog in forum Bridgeport / Hardinge Mills
    Replies: 2
    Last Post: 12-20-2007, 04:33 AM
  4. Should I get 5.0 or wait for 6.0, or
    By fc911c in forum Visual Mill
    Replies: 10
    Last Post: 03-01-2007, 04:26 PM
  5. R2E3 Boss 8 Display says E!!!! WAIT
    By hrhoward in forum Bridgeport / Hardinge Mills
    Replies: 1
    Last Post: 09-08-2006, 04:13 AM

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
  •