Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 11:15:48 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
Percent Complete
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: Percent Complete (Read 1725 times)
0 Members and 1 Guest are viewing this topic.
bdring
Active Member
Offline
Posts: 30
Percent Complete
«
on:
December 01, 2007, 10:54:11 AM »
Is there a way to determine what percent of the g-code has run? (i.e. current line / total lines * 100). I would like to make large display that I can see from across the room that gives me a rough idea how far I am through the job.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Percent Complete
«
Reply #1 on:
December 01, 2007, 11:49:06 AM »
yes,
you could enter into a usrdro (drop it on the screen), the last line number of your program, Then in the macro pump do a x=Getoemdro(currentline) you will need to look up the dro number, then say y=getuserdro(where you entered the last line), The formula in teh macropump would be: percentrun= ((x/y)*100) Then also put another user dro on your screen that will display the amount compleated send the rusult to this dro on the screen: SetUserDro(mydronumber, percentrun). so you will need to add two user dros to the screen.
enable macro pump and restart mach, you will have to use line numbers.
scott
«
Last Edit: December 01, 2007, 11:50:48 AM by poppabear
»
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
zealous
Active Member
Offline
Posts: 486
Re: Percent Complete
«
Reply #2 on:
December 01, 2007, 07:25:49 PM »
Cant help but think Brains would be better then the Macropump and there is a automated way to get the last line of Gcode or total file size...
Nice thing about this is in Flash we can display bar graphics or images to display amount completed and invoke scripts once at any point.
Here is the standard Mach3 1024.set modified with a page that has a large toolpath and DRO displaying amount completed.
Also included is the Macropump file, remember to turn on your macropump in the config page.
Code:
filesize = GetOEMDRO(1200)
filecurrent = GetOEMDRO(816)
'=== Get percent ===
completed = ((filecurrent / filesize) * 100)
Call setuserDro(1201,completed )
GcodePercent.zip
(17.1 KB - downloaded 50 times.)
Logged
Regards, Jason Blake
www.Fusioncnc.com
bdring
Active Member
Offline
Posts: 30
Re: Percent Complete
«
Reply #3 on:
December 02, 2007, 09:30:54 AM »
Thanks for the help, but it is not working. The macro gets a divide by zero error as soon as mach loads. I surrounded the calculation with "If filesize <> 0". That stopped the error, but it appears filesize is never non zero because the DRO never changes. I am having trouble finding documentation on the codes. Where do you find the code to get the filesize?
Logged
Bodini
Active Member
Offline
Posts: 112
Re: Percent Complete
«
Reply #4 on:
December 02, 2007, 09:53:47 AM »
Funny, i was thiking about this same thing just this week. current line of code / # of lines of code isnt a real indicator of progress. Unless the code is uniform in how long the machine takes to do it, it could be way off. What if the code is g0x0y0, g1x20f20, g1y1? See what i mean? Its going 20 units, then 1, but it would read 50% done when it was actually like 95%!
I know, i know, you wanted a
rough
way to tell.
Maybe dro (814)/(815)? you'd have to dobutton (1015?) first though to get the estimate established.
-Nick
Logged
zealous
Active Member
Offline
Posts: 486
Re: Percent Complete
«
Reply #5 on:
December 02, 2007, 01:37:47 PM »
Bdring, Do you have two DRO's 1200 and 1201 in your screen somewhere? You'll have to enter the total number of lines on the "Program Run" page in the screen set I posted....you shouldn't get that error unless you don't have the DRO's displayed in your screen somewhere.
Hey Nick yeah I see what you mean that's totally true...I bet the best result would be to get the total distance the machine has to travel and the current machine speed to give an accurate percentage
precentComple.jpg
(80.92 KB, 600x442 - viewed 229 times.)
«
Last Edit: December 02, 2007, 02:02:02 PM by zealous
»
Logged
Regards, Jason Blake
www.Fusioncnc.com
bdring
Active Member
Offline
Posts: 30
Re: Percent Complete
«
Reply #6 on:
December 02, 2007, 06:01:53 PM »
Thanks...I did not see that DRO to enter the total number of lines.
It works now, but the If statement is needed to prevent the error on start-up.
I knew the issue of accuracy would come up. I really don't care if it is very accurate. I just want to get an idea of when the end is near. I ran a few files today and found the line count method appears to be more accurate than the estimate method on my files and setup. I also really only care if 90-100% area is accurate.
I tried to add button to get the file length with the following VB code.
Code:
Dim I
Dim textLine
Open "c:\mach3\gcode\roadrunner.tap" For Input As #1
While Not EOF(1)
Line Input #1, textLine
I = I + 1
Wend
Close #1
Call setuserDro(1202,I)
It works, but I need to know how to get the filename automatically.
Logged
zealous
Active Member
Offline
Posts: 486
Re: Percent Complete
«
Reply #7 on:
December 02, 2007, 07:33:40 PM »
WOW bdring nice job!!!
Here you go this will work
:
Code:
Dim I
Dim textLine
Open FileName For Input As #1
While Not EOF(1)
Line Input #1, textLine
I = I + 1
Wend
Close #1
Call setuserDro(1200,I)
You can put this along side the "Load Gcode" button but....I think that the VB "load Gcode" is spitting an error...we'll have to report it to Art if any one else is getting this as well...
«
Last Edit: December 02, 2007, 07:44:48 PM by zealous
»
Logged
Regards, Jason Blake
www.Fusioncnc.com
bdring
Active Member
Offline
Posts: 30
Re: Percent Complete
«
Reply #8 on:
December 03, 2007, 08:39:25 AM »
Excellent...that did it. In case it does not show...this is my first day tweaking Mach. I am a seasoned programmer, but I am having difficulty tracking down some of Mach's finer details.
I am not sure what you mean with the "load GCode" button. I was trying to redo the Load button so it loads the file then calculates the length. It tried a DoOEMButton(216), but it would hang on a part generation dialog box.
Anyway...I decided to try to take it one step further. I programmed a quick PIC chip to output a byte received on the serial port to a pair of seven segment LEDs.
I got Mach to output on the serial port the percent remaining. I changed the value to an integer and tested it for change to prevent it from sending it too often.
I assumed an unused SetVar number to hold the value. I could not find details on what numbers to use.
I found some cheap huge LEDs at
www.futurlec.com
. I will use them if everything proves reliable and useful.
Code:
filesize = GetOEMDRO(1200)
filecurrent = GetOEMDRO(816)
'=== Get percent ===
If filesize <> 0 Then
completed = CInt((filecurrent / filesize) * 100)
Else
completed = 0
End If
If GetVar(2002) <> completed Then
Call setuserDro(1201,completed )
SendSerial(Chr(completed))
Call SetVar(2002, completed)
End If
7-seg.JPG
(19.62 KB, 400x137 - viewed 177 times.)
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Percent Complete
«
Reply #9 on:
December 03, 2007, 12:24:25 PM »
bdring,
Here was what I was talking about, download the zip file, I used an old screen set as an example, it is called "1024percent.set"
on that screen you will see two dros above the Reset button. in the top dro is where you enter in the total number of lines in the file.
NOTE: that if you use the standard convention of numbering the lines by 10's then you will need to divide the last line by 10. The current file line execution dro numbers what line your on by its actual line number.
At any rate put in the last line number in the last line number dro and hit enter.
House keeping: First put the macro pump I sent you called "macropump.m1s" into the macro directory of the profile you are running, then under the configuration>general tick the run macropump box, and tick persistant dros. Also put the above screen set in machs main directory.
close and restart mach.
you will goto the file menu, and load your G code, then put in the last line number in the last line number dro, and hit enter, now hit cycle start, you will see the Percent Dro updating as Mach runs. (remember to divide the last line number by your line number increments if you going by anything other than n1, n2, n3, ...etc.
Scott
Percent_screen.zip
(13.33 KB - downloaded 50 times.)
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages:
1
2
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...