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 26, 2012, 12:00:58 PM
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
Would like Mach3 to find the next tool number during tool change
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: Would like Mach3 to find the next tool number during tool change (Read 824 times)
0 Members and 1 Guest are viewing this topic.
glengeniii
Active Member
Offline
Posts: 26
Would like Mach3 to find the next tool number during tool change
«
on:
July 12, 2010, 08:19:17 PM »
What I mean is that I would like to place a custom userDRO on the screen that would display what tool number is next in line to run after the current tool finishes. This way while tool A is running, I can look on the screen and find which tool to get ready for the next manual tool change. I figure when the tool change macro is ran, I'll use some script to scan ahead and find which tool is next.
So far, I have been able to get the macro to find the line the next tool change is on and post the entire line of code to the message bar, but I'm not sure how to post just the T number (word) to a DRO. I want it posted to the DRO because any messages are immediately replaced in the history file.
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
Message "()" & linestring 'post the entire line of code to the history folder
Found = True
MsgBox " Your next toolchange position is at line "& i
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
My question is, how can I get the tool number (T word) set to a user dro.
Logged
BR549
Active Member
Online
Posts: 2,553
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #1 on:
July 12, 2010, 08:31:24 PM »
YOu may want to send the String to a USER Label They act just like the message bar but the message stays put until you change it.
OR you can create a UserDro on the screen and format the String "Number" and place in the Dro by SetUserDro(####) #### is the dro#
Logged
glengeniii
Active Member
Offline
Posts: 26
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #2 on:
July 13, 2010, 01:19:26 AM »
How would I send the string to a user label. I don't think it's possible.
Thanks
Logged
glengeniii
Active Member
Offline
Posts: 26
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #3 on:
July 13, 2010, 04:02:07 PM »
I think your misunderstanding what I'm trying to ask. I know how to set DRO's, what I can't figure out is how to extract the T number from the line string. The VB script I have so far will find the next line of code with the M6, and stores it as a string of text "linestring". So an example would be that linestring = N1000 T3 M6 G43 H3. I would like to be able to grab the number after the T word (3) and store it as "NextTool" so that it can then be set setuserDRO (1152,NextTool). I've been able to do it with some very crude impractical methods that use the run from here button and require preparation moves. One method that I would like to use looks something like this;
1000
n=n + 1
If n>256 Then
Code "(no tool found)"
setuserDRO (1152,0)
end if
exit sub
Else
If ((InStr(linestring,"T" & n ) Then
setuserDRO (1152,n)
end if
exit sub
Else
goto 1000
Where n is an integer from 0 to max. tool number ( I think it is 256)
linestring is the string of text that appears in the Gcode.
I would like to run this script in the M6 macro, and I want to avoid preparation moves.
This code works if the line says: If ((InStr(linestring,"
T3
" ) but it does when I use If ((InStr(linestring,
"T" & n
) even if I insert
n=3 into the script
Any help would be appreciated.
Thanks
Logged
Ya-Nvr-No
Active Member
Offline
Posts: 268
Scuptris 3D
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #4 on:
July 13, 2010, 07:27:38 PM »
Dim position As Integer
Dim ToolNo As Integer
linestring = "N1000 T3 M6 G43 H3"
position=InStr(linestring, "T" )
ToolNo=Mid(linestring,position+1,2) 'as long there is a space after the tool number
Logged
BR549
Active Member
Online
Posts: 2,553
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #5 on:
July 13, 2010, 07:37:11 PM »
Userlabels work just fine you should be able to send your string staright to a userlabel.
As to the DRO route you will have to work that out. Isolate what you need and format as a double and it should work fine.
NOW IF you were to rethink your Gcode you could do it the way we did with look ahead toolchangers.
State the T# in advance such as
T10
*
*
*
*
*
*
M6
G43 H10
T9
This way the Tool# is loaded into the hold que in advance of its use AND that number can be directly displayed in a DRO on screen. Then when needed for tool change the M6 transfers the tool into the current tool and then you state the next TOOL in advance. The look ahead tool changers used this to have the next tool standing by and ready to swap. Saved a lot of time in tool changes waiting for the tool to get ready.
AND there is not a need for a VB scheme to do what you want.
Just a thought,(;-)
Logged
zealous
Active Member
Offline
Posts: 486
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #6 on:
July 13, 2010, 07:47:21 PM »
If you want to get the next tool with that code I would count back from 3 characters out from T and check to see if it is numeric.
Code:
Dim filesys As String
Dim currentLine As String
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim i As Integer
i = 0
currentLine = GetOEMDRO(816)+1
Set filetxt = filesys.OpenTextFile(FileName , 1, True)
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
ToolIndex = InStr(linestring,"T")
For d = 3 To 0 Step -1
ToolNum = Mid(linestring,ToolIndex+1,d)
'Msgbox ToolNum
If IsNumeric(ToolNum) Then
N = GetToolDesc(ToolNum)
D = GetToolParam(ToolNum,1)
L = GetToolParam(ToolNum,2)
SetUserLabel(1, ToolNum & " " & N)
SetUserDRO(2000,ToolNum)
Exit For
End If
Next d
Exit Do
End If
End If
End If
Loop
'MsgBox GetUserDRo(2000)
'MsgBox GetUserLabel(1)
filetxt.Close
Set filesys = Nothing
Set filetxt = Nothing
Logged
Regards, Jason Blake
www.Fusioncnc.com
Ya-Nvr-No
Active Member
Offline
Posts: 268
Scuptris 3D
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #7 on:
July 13, 2010, 08:49:25 PM »
most times I do what BR549 mentioned, just put it on a line by itself well before calling the m6 toolchange
then you don't have to worry about stripping out any additional characters.
«
Last Edit: July 13, 2010, 08:55:16 PM by Ya-Nvr-No
»
Logged
Ya-Nvr-No
Active Member
Offline
Posts: 268
Scuptris 3D
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #8 on:
July 13, 2010, 09:22:05 PM »
or
Dim linestring ,shortlinestring As String
Dim lenstring, position ,spaceposition, nextpos, ToolNo As Integer
linestring = "N1000 T344 M6 G43 H3"
position=InStr(linestring, "T" )
lenstring=Len(linestring)
shortlinestring= Right(linestring,lenstring-position)
spaceposition=InStr(shortlinestring, " " )
ToolNo=Mid(linestring,position+1,spaceposition) 'as long there is a space after the tool number
you could do a value compare to make sure it is a number and not a character if no spaces are used.
just a small little for x=1 to 3 next loop
Logged
glengeniii
Active Member
Offline
Posts: 26
Re: Would like Mach3 to find the next tool number during tool change
«
Reply #9 on:
July 14, 2010, 01:03:32 PM »
Thanks for the help, this is exactly what I needed. The idea of stating the T# in advanced is a good idea but the CAM program I use does not all it and I don't want to have to manually edit the programs. I'm still interested in learning how to post to user labels. I didn't think this was possible because in Screen4 when you add a user label to the screen, the label has no specific number to identify it from other labels, unlike the DROs. If I could post to a user label and use it as another message bar that would be great.
Thanks
Logged
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...