Hello Guest it is March 29, 2024, 07:02:15 AM

Author Topic: Opening g-code  (Read 3773 times)

0 Members and 1 Guest are viewing this topic.

Offline Seba

*
  •  23 23
    • View Profile
Opening g-code
« on: September 20, 2019, 04:04:32 PM »
Hello. Please help, how do I set up Mach Counter in Mach Screens?
My second request was wanted on the desktop waving to insert keys with g-cods because I still mill 5 same items.
Thank you

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Opening g-code
« Reply #1 on: September 20, 2019, 08:22:55 PM »
Create a button a Label and a DRO on the screen of your choice.

Set the DRO to a user variable e.g. 1200

Set label to "Part Counter" and position close to DRO

Label the button "Reset Counter" and set it to run vb script

Enter VB code :-

SetUserDRO(1200,0)

Save screen.

Then on the end of every g-code file just before the M30 enter

#1200 = [#1200 + 1]

Or you can set up a Macro to do it

M1025.m1s
count = GetUserDRO(1200)
count = count + 1
SetUserDRO(1200, count)

« Last Edit: October 01, 2019, 10:57:18 AM by Graham Waterworth »
Without engineers the world stops

Offline Seba

*
  •  23 23
    • View Profile
Re: Opening g-code
« Reply #2 on: September 21, 2019, 04:07:03 AM »
Hello.
thank you very much for your help, I can ask for a more detailed explanation because I know neither programming nor too much on Mach 3, so I would be very grateful for some file or video tutorial.

Offline Seba

*
  •  23 23
    • View Profile
Additional button Mach Screens
« Reply #3 on: September 28, 2019, 05:01:40 PM »
hello how to add an extra button in
Mach Screens which will open g-cod from file C:\Users\Sebastian\Desktop\PRACA\CNC\ciastk.tap

Offline ZASto

*
  •  423 423
    • View Profile
Re: Opening g-code
« Reply #4 on: September 29, 2019, 07:29:11 AM »
Create a button a Label and a DRO on the screen of your choice.

Set the DRO to a user variable e.g. 1200

Set label to "Part Counter" and position close to DRO

Label the button "Reset Counter" and set it to run vb script

Enter VB code :-

setuserdro(1200,0)

Save screen.

Then on the end of every g-code file just before the M30 enter

#1200 = #1200 +1



Wel, Graham
The incrementing of the #1200 works, incrementing is not shown in DRO


Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.

Offline Seba

*
  •  23 23
    • View Profile
Re: Opening g-code
« Reply #5 on: September 29, 2019, 11:33:43 AM »
What is wrong?

Offline ZASto

*
  •  423 423
    • View Profile
Re: Opening g-code
« Reply #6 on: September 29, 2019, 02:19:47 PM »
Not incrementing DRO, user variable incrementing.
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Opening g-code
« Reply #7 on: September 30, 2019, 12:21:03 PM »
Try a different DRO, #1200 may be in use by another macro
Without engineers the world stops

Offline ZASto

*
  •  423 423
    • View Profile
Re: Opening g-code
« Reply #8 on: September 30, 2019, 06:38:12 PM »
You were right, I use 1200 for some other things, but...
even if I change the variable to, eg. 999 or 1000 (with corresponding changes in screenset), still no update of DRO.

It only works if I call a macro.

Code: [Select]
M1100.m1s:

counter = getuserdro(1100)
counter = counter + 1
setuserdro(1100, counter)

Anyway, I tried to help Sebastian since I do need counters :)
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.

Offline Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Opening g-code
« Reply #9 on: October 01, 2019, 10:52:17 AM »
That should not be a problem, just add the M1100 to the end of your program and it will work.

How did you want it to work?

Without engineers the world stops