Machsupport Forum
Mach Discussion => Mach Screens => Machscreen Screen Designer => Topic started 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 !
-
can someone at least let me know if this is possible ?
brain....script .... voodoo ?
Thanks :)
-
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)
-
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
-
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
-
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
-
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
-
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
-
code....
G20 G40 G49 G54 G80 G90 G91.1
G0 Z0.2
M1001
M06 t4
G00 G90 G54 X1.435 Y1.435
-
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
-
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
-
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.
-
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
-
but that is where it is saved. my profile is MyMill.
C:\Mach3\macros\MyMill\M1001.m1s
-
works just fine here. please post your macro.
-
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
-
::)
-
thank you very much ;D