Welcome, Guest. Please login or register.
Did you miss your activation email?
February 13, 2012, 01:44:26 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Feature Requests
| | |-+  Search function
Pages: 1   Go Down
Print
Author Topic: Search function  (Read 1306 times)
0 Members and 1 Guest are viewing this topic.
ostie01
Active Member

Offline Offline

Posts: 552


View Profile
« on: November 24, 2009, 06:46:54 PM »

It would be great if we could have access to a search function inside the Gcode window like search for the next tool change, next M01.

This could be a great add on since the line number in the Gcode window does not always match the one in the edit window,

Just an idea.

Jeff
Logged
Chaoticone
South Carolina, US
Administrator
*
Offline Offline

Posts: 3,566


Precision Chaos



View Profile WWW
« Reply #1 on: November 25, 2009, 06:44:20 PM »

Thats a good idea. I don't know if it is doable but it a good one I think.

Brett
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #2 on: December 29, 2009, 03:58:13 AM »

this will look for M6/M06 but you can simply change it to look for whatever you want and it will highlight that line in the Gcode for you...but you will tell it what to do after that example: (RFH or SetNextLine)

Code:
Dim currentfile As String
Dim filesys, filetxt, lastline, oldline As String
Dim currentLine As String
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
currentLine = GetOEMDRO(816)
Found = False
currentfile = FileName
Set filetxt = filesys.OpenTextFile(currentfile, ForReading, True)
Dim i As Integer
i = 0
Do While filetxt.AtEndOfStream <> true
linestring = UCase(filetxt.ReadLine()) & " "
If linestring <> " " Then
i = i+1
If i > currentLine Then
If ((InStr(linestring,"M6") >0 Or InStr(linestring,"M06")>0)) Then
SetOEMDRO(816,i)
Found = True
MsgBox "File has been set to line:"& GetOEMDRO(816)&" Your next toolchange position.Your previous line was:"&currentLine
Exit Do
End If
End If
End If
Loop
If Found = False Then
MsgBox "No M6/M06 Found after LINE:"& currentLine
End If
filetxt.Close
Set filesys = Nothing
Set filetxt = Nothing

thanks,
Jason Blake
Logged

Regards, Jason Blake

www.Fusioncnc.com
sunmix
Active Member

Offline Offline

Posts: 35


View Profile
« Reply #3 on: December 31, 2009, 10:56:32 PM »

Can I modify the script to count how many M03's are there? and detect which line number the M03's are?
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #4 on: January 12, 2010, 09:39:34 PM »

sorry I did not know you posted...

this will save the positions of the M6's to a text file located in the Mach3 directory, then open it if it finds M6,listing the line number and content on those lines.
Just change the
Code:
If ((InStr(linestring,"M6") >0 Or InStr(linestring,"M06")>0)) Then
to M3 Wink

Code:
Dim currentfile As String
Dim filesys, filetxt, lastline, oldline As String
Dim currentLine As String
Dim dTaskID As Double, path As String, StoreFilePath As String
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
StoreFilePath = CurDir & "\StoredM6.txt"
path = "C:\WINDOWS\notepad.exe"
Set objTextFile = filesys.CreateTextFile(StoreFilePath)
currentLine = GetOEMDRO(816)
Found = False
currentfile = FileName
Set filetxt = filesys.OpenTextFile(currentfile, ForReading, True)
Dim i As Integer
i = -1
j=0
Do While filetxt.AtEndOfStream <> true
linestring = UCase(filetxt.ReadLine()) & " "
If linestring <> " " Then
i = i+1
If ((InStr(linestring,"M6") >0 Or InStr(linestring,"M06")>0)) Then
j = j+1
objTextFile.WriteLine(j & " " & "Line# " & i & " " & linestring)
Found = True
End If
End If
Loop
If Found = True Then
dTaskID = Shell(path + " " + StoreFilePath, vbNormalFocus)
Else
MsgBox "No M6/M06 Found"
End If
filetxt.Close
Set filesys = Nothing
Set filetxt = Nothing
objTextFile.Close
« Last Edit: January 12, 2010, 09:44:42 PM by zealous » Logged

Regards, Jason Blake

www.Fusioncnc.com
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!