Hello Guest it is March 28, 2024, 08:17:47 PM

Author Topic: having a script issue.  (Read 5190 times)

0 Members and 1 Guest are viewing this topic.

having a script issue.
« on: February 11, 2006, 10:20:19 PM »
doing a little code to zero work z. program works fine when i single step through it but when i run it from a button, not so good. here is the
here is the code.

feed = getdro(18)
if suchsignal(22) then

code "g31 z-7 f35"     'seek the sensor fast
while ismoving()
wend

sensor = getoemdro(85)  'get machine z position
pull back = sensor +.1     'add .1 to machine z

code "g53 g01 z" & pullback   'move z upto clear sensor
while ismoving()
wend

nextmove = getoemdro(85)  ' get new machine z position
move = nextmove - .11       ' set up for next machine move

code "f1"
code "g31 z" & move   ' slow sensor seek
while ismoving()
wend

ofst = getoemdro(1001)   ' get sensor height
call setdro(2, ofst)           ' set work z dro to sensor height

code "f" & feed              ' reset feed rate

end if

end

ok here is the problem i  have.  when i step through the script using the editor i works great, just like i wanted it to. 

this line "call setdro(2, ofst)  sets the work dro to sensor height ,then from the mdi line i can type in g01 z0 and it will move the tool down to top of part.

when i run it from the auto zero button it won't set dro 2 to the right offset.

any ideas

thanks rob


Re: having a script issue.
« Reply #1 on: February 12, 2006, 07:41:08 AM »
I made a few changes to your code and I think it should fix you up... My test mill is down so I can't test it here:(
To get the PROBE data you need to do a GetVar(2000) = X 2001 = Y 2002 = Z
Hope that helps
Brian


feed = getdro(18)
if suchsignal(22) then

code "g31 z-7 f35"     'seek the sensor fast
while ismoving()
wend

sensor = getvar(1002) ' getoemdro(85)  'get machine z position //check this line
pull back = sensor +.1     'add .1 to machine z

code "g53 g01 z" & pullback   'move z upto clear sensor
while ismoving()
wend

nextmove = getoemdro(85)  ' get new machine z position
move = nextmove - .11       ' set up for next machine move

code "f1"
code "g31 z" & move   ' slow sensor seek
while ismoving()
wend

ofst = getoemdro(1001)   ' get sensor height
code"G4P.2" 'Pause to let Mach3 update //Added a line here
call setdro(2, ofst)           ' set work z dro to sensor height

code "f" & feed              ' reset feed rate

end if

end
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: having a script issue.
« Reply #2 on: February 12, 2006, 02:18:53 PM »
when i put in the line
sensor = getvar(2002)

i get no value what so ever when i step through that kine of code.
 and i still have the problem of not geting the right data into DRO(2)
most the time it puts in 1.6********* and oemdro(1001) is set to 1.7055
even if i take out the
  ofst = getoemdro(1001)  and just put in
  call setdro(2,1.7055) it still wont work.

this is where my problem lies the program is working other than setting the dro to sensor height so that i can
take enter a g01 z0 and move my axis to top of part.  the program works great when i step through it.
Re: having a script issue.
« Reply #3 on: February 12, 2006, 03:17:11 PM »
sorry first line should read is
sensor = getvar(1002) not (2002)
had a typo while reposting and could not edit
Re: having a script issue.
« Reply #4 on: February 12, 2006, 06:27:06 PM »
Try adding a few G4's to the program. This can give some time for the dro's to update (only need a few micro sec).


  ofst = getoemdro(2002)
code "g4 p.5"  '<-- add this line and test it
While ismoving()
wend
  call setdro(2,1.7055)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: having a script issue.
« Reply #5 on: February 13, 2006, 05:35:38 PM »
thank you Brian the g4's them selves did not do any thing but the while wend statement after them did.
id there a pause statement or wait statement in the vb script.  i could not find any thing in the cypress pdf. unless
i over looked it.
any ways thank's again.

Rob
Re: having a script issue.
« Reply #6 on: February 13, 2006, 06:03:51 PM »
GREAT!!!

Happy codeing :)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com