Hello Guest it is July 15, 2024, 12:51:44 PM

Author Topic: How do I get my X, Y, and Z axis DROs to reset in this script?  (Read 22457 times)

0 Members and 1 Guest are viewing this topic.

Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #20 on: May 17, 2009, 05:38:28 PM »
Quote
IF you just go to the VB editor and type in     Setdro(0,0.000)  then run it doe s the x axis DRO change to 0.000?
Yes...
I tried this for each of the 3 axis - (Setdro(0,0.000) for X, Setdro(1,0.000) for Y and Setdro(2,0.000) for Z. They all work perfectly. The problem must be within the script. I'll see about rewriting the script slightly simplified and see if I can identify the issue(s).
At least I know the Setdro(0,0.000) command works on my machine. This is a milestone in itself.

vmax549

*
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #21 on: May 17, 2009, 09:03:28 PM »
OK are you saying that at the end of the macro the DROs are readiing something other than 0.000 Or do you mean the machine is out of postion by those amounts while the dros are reading 0.000. ??

I don't see anything in your code that would cause the Dro to reading other than 0.000.

BU I do see a couple of things that may leave it OUT of postion.

Just a thought, (;-) TP

(;-) TP
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #22 on: May 17, 2009, 09:18:46 PM »
Quote
vmax549 - OK are you saying that at the end of the macro the DROs are readiing something other than 0.000 Or do you mean the machine is out of postion by those amounts while the dros are reading 0.000. ??
When the probing script completes, the mill is directly centered on the part both on the X and Y axis. Additionally the mill is at the top of the part- just touching. This is the exact position that I manually reset the X, Y, and Z DROs before running my slot cutting program. The machine positions itself exactly where it should when the probing script completes, it just resets the DROs to something other than zero.
When the DoOEMButton(1008), or Setdro(0,0.000) cammands run at the end of the script, the result is as follows.
The X axis DRO is changed to +0.6105 (this number does vary slightly on occasion)
The Y axis DRO is changed to +0.0000
The Z axis DRO is changed to +0.4000
I have yet to try adding a delay before running the DRO reset command to give Mach3 a chance to catch the mill up to the executed code.
Quote
vmax549 - BU I do see a couple of things that may leave it OUT of postion.
If you see specific problems with the scipt, please let me know. As I mentioned before, I'm very new at this and would like to corect any mistakes I've made before they get to be habbits.
Cheers.

vmax549

*
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #23 on: May 18, 2009, 09:39:27 AM »
AS long as it ends at the proper location then all is well(;-).

Try this, Delete the resetting of the DROs from the script. ADD an "end" to the end of the scriptThen let it run to completion.

Then from a seperate script do the dros resetting to zero. Just curious.

There is NOTHING I know of that will effect the Setdro() command from inside your script. It does NOT draw from any inside VAR or DRO so any errant value should NOT show up.

THE ONLY thing I can think of is that the axis has NOT stopped at the time your code is updating the value to zero so there is some overrun at times. 

IF the seperate script cures the problem then on the old script BEFORE the commands to zero the dros add  Code"G04 P0"  this will force Mach to empty the motion  buffer before doing the next command.

Just a thought, (;-) TP

(;-) TP
« Last Edit: May 18, 2009, 09:49:36 AM by vmax549 »
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #24 on: May 19, 2009, 06:18:37 AM »
HI
IM HAVING PROBLEMS WITH THE MACH BLUE SCREEN SCRIPT
I USE METRIC
I HAVE TRIED CHANGING IT MYSELF, I CAN'T GET IT TO WORK
I NEED A SCRIPT THAT CAN FIND THE CENTER OF A 40 mm PIPE
AND MOVE AT ABOUT 100mm A MINUTE
CAN ANYONE HELP ME PLEASE?
EDDIE
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #25 on: May 19, 2009, 06:42:10 AM »
Quote
Try this, Delete the resetting of the DROs from the script. ADD an "end" to the end of the scriptThen let it run to completion.
Then from a seperate script do the dros resetting to zero.
I ran the probe script and the DRO reset script seperately. They both wook as they should. I'll try your suggestion using the END command as well as the G04 P0 command this evening to see if I can get everything working in a single script.
Thanks!
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #26 on: May 21, 2009, 06:34:32 AM »
Well, the END command did not change anything. I also added the G04 P0 command but the DROs are still resetting to values other than zero. I even tried a 10 second wait command (G04 P10) but this did not change anything either. Interesting note though, the DROs changed value prior to the 10 seconds expiring.
By placing the DRO reset commands in a separate script, I can successfully get all 3 axis to reset to zero as they should.
Can you give me an example of how I would call this second script containing only the DRO reset commands from within the first script? I’ve heard calling scripts from within scripts is bad practice but it may just be the fix I’m looking for.
Thanks,
-Aaron

vmax549

*
Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #27 on: May 21, 2009, 10:21:09 AM »
(;-) OK try this Before the DRO updating

While ISMOVING()
Sleep (2000)
Wend

You can try the macro from a macro BUT beware strange things have been known to happen.

Set up the separate code as a separate macro (say M200) then just call the macro from the first macro

Code"M200"

or just 

Call M200

Heck give it a whirl, but please try the WhileIsmoving/sleep thing first

(;-) TP






Re: How do I get my X, Y, and Z axis DROs to reset in this script?
« Reply #28 on: May 21, 2009, 11:28:26 PM »
Another trick is to add a Sleep(300) just after calling SetDRO, especially if the next line in your script calling a moving the same axis you just changed the DRO for. It looks like there is a synchronization problem between the VB script and the mach driver (probably running in different processes or threads) Otherwise the next move might be executed based on the previous DRO position, not the one you just set.

This solved a problem for me anyway. Worth a try.

EK