Welcome, Guest. Please login or register.
Did you miss your activation email?
October 21, 2014, 01:20:51 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  G-Code, CAD, and CAM
| |-+  G-Code, CAD, and CAM discussions
| | |-+  Total lines in the G Code for each file ??
Pages: 1 2 »   Go Down
Print
Author Topic: Total lines in the G Code for each file ??  (Read 1193 times)
0 Members and 1 Guest are viewing this topic.
Usamahan
Active Member

Offline Offline

Posts: 11


View Profile
« on: February 29, 2012, 11:43:56 AM »

Hello

I would like to know if there is a Gcode or macro to give me the total numbers of the lines for each file I open in mach3 ??
In other words, I want a dro or input to show me the total lines for the file in the mach3 page.

Regards,
U.H
Logged
Tweakie.CNC
Global Moderator
*
Offline Offline

Posts: 4,741


Super Kitty.


View Profile WWW
« Reply #1 on: February 29, 2012, 12:03:14 PM »

Hi UH,

If you double click on the program window it will append line numbers to the GCode lines and you can just scroll to the bottom line to read the total.

Tweakie.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Usamahan
Active Member

Offline Offline

Posts: 11


View Profile
« Reply #2 on: February 29, 2012, 12:42:26 PM »

Thank you Tweakie ,

I want to put this macro in the open file button to give me the total lines in the file ( automatic) as a OemDro .
I will use it for percent program process.(which give me % of the job finished).

UH
Logged
BR549
Mach4 Alpha

Offline Offline

Posts: 5,120


View Profile
« Reply #3 on: February 29, 2012, 01:19:58 PM »

I normally don't give out the secret handshake but try this is does what you need. You will need to change the output from a message to the UserDRo you need.


'Macro to assign Gcode Total Line count
Sub ReadStraightTextFile()
Dim LineofText As String
Dim rw As Long
rw = 0
Open "" & Filename() For Input As #1
Do While Not EOF(1)
Line Input #1, LineofText
rw = rw + 1
Loop
'Close the file
Close #1
Message ""& (RW+1)
End Sub

(;-) TP
Logged
Tweakie.CNC
Global Moderator
*
Offline Offline

Posts: 4,741


Super Kitty.


View Profile WWW
« Reply #4 on: March 01, 2012, 02:20:34 AM »

My apologies UH - I did not read your question properly  Roll Eyes

Tweakie.
Logged

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Usamahan
Active Member

Offline Offline

Posts: 11


View Profile
« Reply #5 on: March 01, 2012, 02:44:14 AM »

Thank you BR549 , it works, (even it takes a long time to load the file), this is what I need. Fast solving problems.Thank you again.

UH
Logged
Usamahan
Active Member

Offline Offline

Posts: 11


View Profile
« Reply #6 on: March 01, 2012, 04:39:03 AM »

BR549, I only have one more question.

All my files are more than 300.000 lines, so when I put your code, it took about 2 minutes and 30 seconds to load the file, while when I open it without the code it takes only 11 seconds.
So what I mean is, is there any way that we can know the total lines for the file without counting them one by one as the code did, so it can take less time ??

And of course thank you for your help, and I appreciate it.


Regards,
UH
Logged
Ya-Nvr-No
Global Moderator
*
Offline Offline

Posts: 772


View Profile WWW
« Reply #7 on: March 01, 2012, 07:38:09 AM »

DRO 233 reports the total lines in a file.
DRO 240 reports the line number that I are currently running.
DRO 816 reports the line number your scrolling thru in the file if I am looking for something.

I have the DRO's on my main page I added them with machscreen but you can use screen4 I am sure.


* line.JPG (10.97 KB, 175x53 - viewed 49 times.)
Logged

Overloaded
Global Moderator
*
Offline Offline

Posts: 4,074



View Profile
« Reply #8 on: March 01, 2012, 08:29:20 AM »

YNN, where did you find 233 ?
It's not in any of the lists that I have.
Thanks,
Russ
Logged

"You cannot help men permanently by doing for them what they could and should do for themselves."
Abe Lincoln

 "One of the penalties of not participating in politics is that you will be governed by your inferiors."
Usamahan
Active Member

Offline Offline

Posts: 11


View Profile
« Reply #9 on: March 01, 2012, 08:50:43 AM »

Thank you Ya-Nvr-No ,
This is exactly what I need. Now I can open long files in the same time with a total line number which I will use it to give me a percentage of the finished work.
Thank you again, and I want to thank all the members for their help.

UH
Logged
Pages: 1 2 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!