Hello Guest it is March 28, 2024, 08:19:08 AM

Author Topic: VB Button: Pause and Raise Z  (Read 7636 times)

0 Members and 1 Guest are viewing this topic.

VB Button: Pause and Raise Z
« on: June 18, 2009, 01:06:05 PM »
I am new to Mach3 and attempting to code the Pause button to stop the machine and raise the Z spindle height.  I am not very familiar with VB and am having trouble making the spindle rise after I have told it to pause... Any Ideas??

Thanks
Anthony

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: VB Button: Pause and Raise Z
« Reply #1 on: June 18, 2009, 01:42:31 PM »
Something like this will move the Z up 2":


DoOEMButton(1001)
While IsMoving()
Sleep 100
Wend
Code "G0 Z2"
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: VB Button: Pause and Raise Z
« Reply #2 on: June 18, 2009, 03:36:09 PM »
Worked perfect!

Is there any way to change the delay between the time the pause button is pressed and when the machine actually halts movement?  There seems to be about a 1 second delay.

Thanks!

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: VB Button: Pause and Raise Z
« Reply #3 on: June 19, 2009, 11:57:49 AM »
Hi Anthony,
When you feedhold the machine the amount of time it takes to come to a stop will depend on your motor tuning Accel/Velocity.
You can either change this if your motors permit or use the "stop" (1003) rather than a "FeedHold" (1001)
Re: VB Button: Pause and Raise Z
« Reply #4 on: June 19, 2009, 12:26:23 PM »
Not being familiar with this I have to ask ! The code snippet above must function in incremental ? Will it still go up if you are cutting above 2" or will it go down to 2" ?
CRUISER
  Don

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: VB Button: Pause and Raise Z
« Reply #5 on: June 19, 2009, 01:02:15 PM »
Yes in ABS it will go down to 2 inchs...so if your machine is at 2.000 and you run the script the machine will just sit there ;)
If you are at 3.000 it will come down/up (depending on your machine)  to 2.000.

If you want to increament in ABS you can:

Code: [Select]
DoOEMButton(1001)

'Wait for machine to stop
While IsMoving()
Sleep 100
Wend

'Get current Z
current_Z = GetOEMDRO(802)

'Add 2' to z
inc_z = current_Z + 2

'Sent command you can use G1 as well if need
Code "G0 Z" & inc_z
« Last Edit: June 20, 2009, 06:38:08 PM by zealous »

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: VB Button: Pause and Raise Z
« Reply #6 on: June 19, 2009, 01:38:20 PM »
Sorry, my mistake. Ideally, you'd check if the machine is in abs or inc mode, change to incremental, move up, then change back to whatever it was set to before.
Gerry

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

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: VB Button: Pause and Raise Z
« Reply #7 on: June 19, 2009, 11:10:34 PM »
So then Anthony M above, could have just as easily have crashed his machine ?
Curious indead !
Thanks for the Instruction
CRUISER
  Don

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: VB Button: Pause and Raise Z
« Reply #8 on: June 20, 2009, 06:33:36 PM »
Thank you for pointing that out...that is my bad!

Code: [Select]
'FeedHold
DoOEMButton(1001)

'What mode are we in
mode = GetOEMLed(49)

'Wait for machine to stop
While IsMoving()
Sleep 100
Wend

'Sent command you can use G1 as well if need
Code "G90 G0 Z2"

'If we have changed from abs to inc mode then change back
If mode = true Then
   code "G91"
End If