Hello Guest it is March 29, 2024, 06:59:31 AM

Author Topic: stop waiting G4  (Read 15520 times)

0 Members and 1 Guest are viewing this topic.

stop waiting G4
« on: July 21, 2006, 06:11:13 AM »
Hello

I am using a script for a M function with G4 Pxx (wait xx seconds).Thats fine

Then I want by pressing a button to stop waiting and continue executing next line.
Any help?

Thanx
« Last Edit: July 21, 2006, 06:30:25 AM by axilleas »
Re: stop waiting G4
« Reply #1 on: July 21, 2006, 09:00:58 AM »
It's me again

Accidentally I found that the button I asked above is the "Run" button. :)
BUT
I created a new vb script button with dobutton (0) and some other lines. When I press the green play button in  the script editor it works fine (NOT step by step). When I close the editor and press the button it is not the same!! (feedrate gets equal to x position, the movement is not the next line.... ???)

Thanx

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: stop waiting G4
« Reply #2 on: July 21, 2006, 02:12:50 PM »
Why can't you use an M0 (Mzero) instead of a G4 Pxx, M0 will wait until you press the start button.

Graham.
Without engineers the world stops
Re: stop waiting G4
« Reply #3 on: July 22, 2006, 07:24:37 AM »
There is a userDRO with the time xx (G4 Pxx) given by the user. This is the preheat time of an oxy flame.
Usually the user set this userDRO before start cutting without knowing if this time is ok. Usually he sets a high number. During preheat user can see the flame and push a button when he thinks that the time is ok. The time from the start of the preheat is recorded in this userDRO so next time preheat will be ok.
So M0 is not an option.

Thanx
Re: stop waiting G4
« Reply #4 on: July 24, 2006, 04:20:43 AM »
Here is the button script

c=Timer()
totaltime=(c-getuserdro(1002))
setuserdro(1000,totaltime)   
dooembutton(1000)   


1002 userDRO is the time from the beginning of the preheat. I use M18 to fill 1002 up.

b=Timer()
setuserdro(1002,b)
preheat=getuserdro(1000)
ActivateSignal(Output4)
code ("G4 P" & preheat)


totaltime is the the xx (G4 Pxx) time
dooembutton(1000)=dobutton(0) I think. I tried them both.

As I have described when I use the normal Run button it stops waiting and continue with next line. When I use this button the calculations in the first 3 lines are done correctly but then the feedrate gets equal to Xposition and it moves to a no sense place. When it reaches that place it continues as if it has done next line.
Appart from the fact that if I have open the script editor and I "play" the script from within the editor, it works fine, it works fine the for the second or third curve.
For example:

N0000 (Filename: Drawing1.tap)
N0010 (Post processor: Copy of Mach2.post)
N0020 (Date: 24/7/2006)
N0030 G21 (Units: Metric)
N0040 G40 G90
N0050 F1
N0060 (Part: Drawing1)
N0070 (Process: No offset 0, Mill/Router, 0,1 mm diameter, 0 mm Deep)
N0080 M6 T0  (Mill/Router, 0,1 mm diameter)
N0090 G43 H0
N0100 G00
N0110 M04
N0120 X180.3516 Y119.7404
N0130 (Part: Drawing1 Duplicate 1)
N0140 M18
N0150 G02 X180.3516 Y119.7404 I-67.4337 J0.0000 F3000.0
N0160 (Process: No offset 0, Mill/Router, 0,1 mm diameter, 0 mm Deep)
N0170 M17
N0180 G00 X170.1790 Y266.9916
N0190 (Part: Drawing1 Duplicate 2)
N0200 M18
N0210 G02 X170.1790 Y266.9916 I-67.4337 J0.0000
N0220 (Process: No offset 0, Mill/Router, 0,1 mm diameter, 0 mm Deep)
N0230 M17
N0240 G00 X306.6313 Y199.9025
N0250 (Part: Drawing1 Duplicate 3)
N0260 M18
N0270 G02 X306.6313 Y199.9025 I-67.4337 J0.0000
N0280 (Process: No offset 0, Mill/Router, 0,1 mm diameter, 0 mm Deep)
N0290 M17
N0300 G00 X388.5027 Y82.7810
N0310 M18
N0320 G02 X388.5027 Y82.7810 I-67.4337 J0.0000
N0330 M05
N0340 G00
N0350 G00 X0 Y0
N0360 G49
N0370 M05 M30

If I push the button while waiting in N0140  >:(
If I push it during N0200, N0260 or N0310 it works well  ???

Thanx
Re: stop waiting G4
« Reply #5 on: July 24, 2006, 04:44:55 AM »
I also found out the "no sense" movement. In G is

G01 X119.7404 Y112.9179 F180.3516

which is not so much "no sense".

Normal line is
G02 X180.3516 Y119.7404 I-67.4337 J0.0000 F3000.0

Y gets X
I gets Y (180.3516-67.4337=119.7404)
and X get F

I though that while N0150 is the first "cutting" line a problem occurs. So I put a G01 F3000 in the beginning but it did not work.

I am very sorry for bothering you so much

Thanx
Re: stop waiting G4
« Reply #6 on: July 25, 2006, 06:04:01 AM »
It is exactly what is being discussed here

http://groups.yahoo.com/group/mach1mach2cnc/message/25060

Thanx
Re: stop waiting G4
« Reply #7 on: July 25, 2006, 07:34:51 AM »
Hello,
You are looking to change the dwell time... Hmmmm I think the best way to change to dwell time with a DRO is to use the M3 and M5 macros :) Much the same way that you have done here:

c=Timer()
totaltime=(c-getuserdro(1002))
setuserdro(1000,totaltime)   
dooembutton(1000)   

1002 userDRO is the time from the beginning of the preheat. I use M18 to fill 1002 up.

b=Timer()
setuserdro(1002,b)
preheat=getuserdro(1000)
ActivateSignal(Output4)
code ("G4 P" & preheat)

totaltime is the the xx (G4 Pxx) time
dooembutton(1000)=dobutton(0) I think. I tried them both.

I don' t get what it is that you are trying to do :( If it was e and I needed to change the Pre heat time I woudl do the following
'M3
preheat=getuserdro(1000)
DoSpinCW()
code ("G4 P" & preheat)

and to turn off

'M5
DoSpinStop()

Sorry i don't see what you need :(

the other thing that you are talking about :

"I also found out the "no sense" movement. In G is
G01 X119.7404 Y112.9179 F180.3516"

What is a "No Sense" Move??? are you talking about a nonprobe move?

we will get you fixed up
Thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: stop waiting G4
« Reply #8 on: July 26, 2006, 02:51:27 AM »
Sorry for not making myself clear. :-[

I use a DRO with dwell time. Instead of M3 I use M18. I do exactly what you said and it is ok.
Your M3 is

preheat=getuserdro(1000)
DoSpinCW()
code ("G4 P" & preheat)

My M18 is

b=Timer()
setuserdro(1002,b)
preheat=getuserdro(1000)
ActivateSignal(Output4)
code ("G4 P" & preheat)

The only difference in that you use DoSpinCW() and I use ActivateSignal(Output4). I also use userDRO 1002 as a public var to store the exact time that preheat was started. I want this time because I have a button with the following script.

c=Timer()
totaltime=(c-getuserdro(1002))
setuserdro(1000,totaltime)   
dooembutton(1000)   

When the user presses THE button during waiting time (dwell) I calculate the "totaltime" var which is the time from the beginning of the preheat and the time THE button is pressed. Then I store this time to the userDRO 1000. This time will be used the next time from M18.

ALL these works fine.

The problem I have is with the DoButton(0) and the equivalent DoOEMButton(1000).

During dwell (G4 Psomething) time you can cancel waiting by pressing the Run button. I put dooembutton(1000) in my button so after the calculation of totaltime the movement to be start. This also works well in all occasions except form one. I have to explain it to you with a small example

N01 G00 X100 Y100
N02 M18
N03 G01 X250 Y200 F3000
N04 M17
N05 G00 X200 Y100
N06 M18
N07 G01 X350 Y200
N08 M17
N09 ....

I have the script editor open with the script of THE button. I press the green play button inside the editor during dwell time in line N02 and it work fine.
I also press it during N06 line and it also works fine. Now I close the editor window.
If I press THE button during N02 "totaltime" calculations are done well but the movement is not G01 X250 Y200 F3000 it is G01 X200 Y0 F250.  :o (Feedrate is the X, X is Y and Y is 0)
If I press the button during N06 then everything is OK. It is OK even if I had already pressed THE button once in N02 or for the first time.

I am again very sorry for not making myself clear. Maybe is my English. It is not my mother language.
Bye from Greece

Thanx
Re: stop waiting G4
« Reply #9 on: July 27, 2006, 10:27:46 PM »
You did well !

Try to use DoOEMButton(288) To cancel the Dwell. This should work :)

Best of luck
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com