Hello Guest it is April 17, 2024, 11:17:44 PM

Author Topic: Need Stop before running script  (Read 3082 times)

0 Members and 1 Guest are viewing this topic.

Offline olf20

*
  •  325 325
    • View Profile
Need Stop before running script
« on: April 17, 2018, 08:22:43 PM »
I have a my probe homing script working and the only
thing I need to finish is;
For some reason the homing script will not
run until I hit stop, then reset.
I have noticed that on the MDI screen that I
can not enter a move until a stop, reset is
done also.
Am I missing something or just need to include
it in my program???
Thanks for any help!

olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Need Stop before running script
« Reply #1 on: April 18, 2018, 01:39:59 AM »
sounds like a endless Loop in your code.
post your code and we will see.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #2 on: April 18, 2018, 06:56:22 AM »
I'll have to get it from the shop today.
This is only when I first start M3.
Once a stop / reset is hit everything
works.
Thanks
olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #3 on: April 18, 2018, 11:02:09 AM »
Attached is the script.
Some of what in the script
was for Z height setting.
I have not cleaned it up yet.
Thanks again
olf20 / Bob



'Check oemdro# And oemled#

SetOEMDRO(800,0.5)
SetOEMDRO(801,0.5)
SetOEMDRO(802,2.0)

Sleep(100)

CurrentFeed = GetOemDRO(818)    'Get the current feedrate.
PlateThickness =1.250      'Set gauge thickness
ProbeFeed = 20         'Set feedrate during probing

Code "G90 F" &ProbeFeed      'Set to Absolute Distance mode

'X Axis Home

If GetOemLed (825)=0 Then   'Check LED to see probe is ready
Code "G4 P1"                   'Time to get to the X-plate
Code "G31X4 F" &ProbeFeed   'Start X probe routine
While IsMoving()      'Probe moving X axis
Sleep(100)
Wend            'End of move
Code "G4 P0.25"         'Pause
XProbePos = GetVar(2000)   'Get position of probe
Code "G0 X" &XProbePos
While IsMoving ()      'Axis moving
Wend            'End of move
Call SetDro (0, PlateThickness)   '?
SetOEMDRO(800,0)      'Set X DRO for correct direction
Code "G4 P0.5"          'Pause for Dro to update.
Code "G0 X-1.065"                 'Change the X retract distance here
Code "(X axis is now homed)"
'Code "F" &CurrentFeed      'Store current feedrate to F
Code "G54 P2"
End If

'Y Axis Home
Code "G90 F" &ProbeFeed      'Set to Absolute Distance mode

Sleep(1000)          'Sleep to finish X routine

If GetOemLed (825)=0 Then   'Check LED to see probe is ready
'Code "G4 P1"                    'Time to get to the  Y-plate
Code "G31Y4 F" &ProbeFeed   'Start Y probe routine
While IsMoving()      'Probe moving Y axis
Wend            'End of move   
Code "G4 P0.25"         'Pause   
YProbePos = GetVar(2001)   'Get position of probe
Code "G0 Y" &YProbePos
While IsMoving ()
Wend
Call SetDro (1, PlateThickness)
SetOEMDRO(801,0)
Code "G4 P0.5"          'Pause for Dro to update.
Code "G0 Y-6.820 F20"       'Change the Y retract distance here
Code "(Axis is now homed)"
'Code "F" &CurrentFeed      'Store current feedrate to F
Code "G54 P2"         'Pause to let code finish

Sleep(6000)         'Sleep to let program catchup
SetOEMDRO(800,8.8641)      'Set X work offset for Spoons
SetOEMDRO(802,2)      'Set Z work offset for All
SetOEMDRO(801,0.0000)      'Set Y work offset for Spoons

Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub

End If

Code "X0 Y0"            'Ready to make spoons
« Last Edit: April 18, 2018, 11:04:05 AM by olf20 »
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Need Stop before running script
« Reply #4 on: April 18, 2018, 11:35:21 AM »
made some changes to your code, pls test

Code: [Select]
'Check oemdro# And oemled#

'Code"1003"

SetOEMDRO(800,0.5)
SetOEMDRO(801,0.5)
SetOEMDRO(802,2.0)

Sleep(100)

CurrentFeed = GetOemDRO(818) 'Get the current feedrate.
PlateThickness =1.250 'Set gauge thickness
ProbeFeed = 20 'Set feedrate during probing

Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode

'X Axis Home

If GetOemLed (825)=0 Then 'Check LED to see probe is ready
Code "G4 P1"             'Time to get to the X-plate
Code "G31X4 F" &ProbeFeed 'Start X probe routine
While IsMoving() 'Probe moving X axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
XProbePos = GetVar(2000) 'Get position of probe
Code "G0 X" &XProbePos
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
SetOEMDRO(800,0) 'Set X DRO for correct direction
Sleep(100) 'Pause for Dro to update.
Code "G0 X-1.065"           'Change the X retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(X axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F
Else
Code "(Plate is grounded, check connection and try again)"
End If

'Y Axis Home
Code "G90 F" &ProbeFeed 'Set to Absolute Distance mode


If GetOemLed (825)=0 Then 'Check LED to see probe is ready
'Code "G4 P1"               'Time to get to the  Y-plate
Code "G31Y4 F" &ProbeFeed 'Start Y probe routine
While IsMoving() 'Probe moving Y axis
Sleep(50)
Wend 'End of move
Code "G4 P0.25" 'Pause
YProbePos = GetVar(2001) 'Get position of probe
Code "G0 Y" &YProbePos
While IsMoving ()
Sleep(50)
Wend
SetOEMDRO(801,0)
Sleep(100) 'Pause for Dro to update.
Code "G0 Y-6.820 F20" 'Change the Y retract distance here
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move
Code "(Y axis is now homed)"
'Code "F" &CurrentFeed 'Store current feedrate to F

SetOEMDRO(800,8.8641) 'Set X work offset for Spoons
SetOEMDRO(802,2) 'Set Z work offset for All
SetOEMDRO(801,0.0000) 'Set Y work offset for Spoons

Else
Code "(Plate is grounded, check connection and try again)"
Exit Sub

End If

Code "X0 Y0"   'Ready to make spoons
While IsMoving () 'Axis moving
Sleep(50)
Wend 'End of move

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #5 on: April 18, 2018, 02:24:22 PM »
Thanks for the reply.
I will try the code tomorrow.
My problem is not that the code does not work
right, it's that it will not run without
first hitting a stop, then reset, when
Mach3 is first started and only first started.
After that the code runs fine.
As I mentioned in my first post some
other functions will not work without
hitting a stop, reset.
Thanks again I really appreciate
your help!!
olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #6 on: April 19, 2018, 10:04:54 AM »
Ran your changes today and the same thing happens.
Script will not run till I hit a stop first.
Hit Auto Z button and the dwell light
blinks for a second or two and then
nothing.
olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline Tweakie.CNC

*
  • *
  •  9,197 9,197
  • Super Kitty
    • View Profile
Re: Need Stop before running script
« Reply #7 on: April 19, 2018, 10:29:47 AM »
Hi Bob,

The problem may be Mach3 version specific. I had a similar issue back in 2012 which was only resolved by adding DoOEMButton(1003) towards the beginning of my code.

Tweakie.
PEACE

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #8 on: April 19, 2018, 11:54:50 AM »
I think you are right.
As I posted earlier I'm not able to
enter any MDI commands either.
Thanks for everyone's help!
olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998

Offline olf20

*
  •  325 325
    • View Profile
Re: Need Stop before running script
« Reply #9 on: April 19, 2018, 05:41:31 PM »
Adding the stop to the beginning of the script solved
the problem.
Thanks TPS for guiding me on proper script writing.
olf20 / Bob
Mach3, Atlas Knee Mill, 4th Axis, VcarvePro, ESS, Super PID.
Been Heating with corn since 1998