Machsupport Forum

Mach Discussion => Mach Screens => Machscreen Screen Designer => Topic started by: Kenneth on March 04, 2013, 09:46:17 AM

Title: User DRO (Counter)
Post by: Kenneth on March 04, 2013, 09:46:17 AM
i usually cut pockets and i woud like a userdro to count each time Z move to the
next depth to cut the pocket. ex.  g1 f4 z-.1 DRO 1...g1 f4 z-.2 DRO 2 ....etc.
but not count just because Z moves. is this possible and do i use a brain ?
Thanks for any help !
Title: Re: User DRO (Counter)
Post by: Kenneth on March 04, 2013, 12:18:20 PM
can someone at least let me know if this is possible ?
brain....script .... voodoo ?

Thanks :)
Title: Re: User DRO (Counter)
Post by: Kenneth on March 04, 2013, 02:25:32 PM
i wrote this(with a lot of reading)don't think it's posssible from what i read.
it works in the VB editor. but not in Mach3.
do i use M1001 in the MDI ?

file name = C:\Mach3\macros\MyMill\M1001.m1s
Count = GetUserDRO(1010)
Count = GetUserDRO(1010)+1
While IsMoving
Wend
SetUserDRO(1010 , Count)   
Title: Re: User DRO (Counter)
Post by: Kenneth on March 04, 2013, 03:19:32 PM
in the VB editor, it changes the dro with each run.
but if i use m1001 in mdi, nothing.
can someone tell me what i'm missing ?
Thanks
Title: Re: User DRO (Counter)
Post by: Ya-Nvr-No on March 04, 2013, 04:56:51 PM
Try a sleep after the SetUserDRO

sleep (1000) 'command is either in seconds or milliseconds depending on your defaults.
might be, it is blowing right thru the command and never get a screen updated.
  or you could try another while loop
sounds like your close. Never give up

Title: Re: User DRO (Counter)
Post by: Chaoticone on March 04, 2013, 05:04:57 PM
Try this Kenneth

Count = GetUserDRO(1010)
Count2 = Count+1
SetUserDRO(1010,Count2)

Not my work so I can't take credit but I bet it will work.

Brett
Title: Re: User DRO (Counter)
Post by: Dan13 on March 05, 2013, 01:26:52 AM
In order for it to work at all you need to call your macro (M1001) after each time your Z is lowered. Unless you actually have M1001 in your Gcode it will do nothing.

Dan
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 06:01:54 AM
thanks Ya-Nvr-No, Brett and Dan13.
Ya-Nvr-No   don't know where the sleep setting is.
i tried it but no idea if working :)
Brett, i used what you had and same results. works in
VB but not in MDI.
Can13. i have it in the gcode but it does nothing. i should be able to
use mcodes in the MDI, shouldn't i ?
Thanks

and the brain is enabled in control
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 06:03:12 AM
code....
G20 G40 G49 G54 G80 G90 G91.1
G0 Z0.2
M1001
M06 t4
G00 G90 G54 X1.435 Y1.435
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 06:44:04 AM
i set sleep 200 and can see the hesitation. still same output.

Count = GetUserDRO(1010)
While IsMoving( )
Wend
Count2 = Count+1
While IsMoving( )
Wend
Sleep 200
SetUserDRO(1010,Count2)
End
     
Title: Re: User DRO (Counter)
Post by: stirling on March 05, 2013, 07:02:56 AM
you don't need any while isMovings, sleeps or variables for what you're doing. If all you want to do is increment a DRO with each call to the macro ALL you need is the single line

SetUserDRO(1010, GetUserDRO(1010)+1)

Type it into the vb editor and try it - THEN make sure you save it correctly and in the right place. If you do that it will run from the MDI AND from GCode.

Ian
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 07:15:56 AM
Thanks stirling,
think that's my problem. not saved in correct location.
in the mach3 directory in C:\Mach3\macros\MyMill\M1001.m1s
from what i read, this is correct.
Title: Re: User DRO (Counter)
Post by: stirling on March 05, 2013, 07:30:43 AM
The point is that if your macro works in the CB editor then changing the code is irrelevant to your problem. I only provided my code because it's the simplest code to do what you want.

The correct location depends on YOUR profile name. If you're using the standard screenset then your profile is displayed at bottom right on the main (program run) screen. The default is usually Mach3Mill. Then you save your macro as c:\Mach3\macros\YOUR PROFILE NAME\M1001.m1s

Ian
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 07:36:09 AM
but that is where it is saved. my profile is MyMill.
C:\Mach3\macros\MyMill\M1001.m1s
Title: Re: User DRO (Counter)
Post by: stirling on March 05, 2013, 07:48:43 AM
works just fine here. please post your macro.
Title: Re: User DRO (Counter)
Post by: Kenneth on March 05, 2013, 07:52:37 AM
found the problem. i WAS running the wrong profile. after sterling said that about the profile bar
in mach3 default. i added the label in my set and opened mach3. showed TheMill not MyMill.
counter works.....THANKS all
Title: Re: User DRO (Counter)
Post by: stirling on March 05, 2013, 08:09:35 AM
 ::)
Title: Re: User DRO (Counter)
Post by: micro-thai on August 24, 2013, 01:46:38 AM
thank you very much  ;D