Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: SWATH on March 21, 2011, 01:39:21 AM

Title: Help with tool changes
Post by: SWATH on March 21, 2011, 01:39:21 AM
Hello,
I'm a new Mach user so I don't know much but I'm in the process of customizing some things and I don't know how to do it.

Here is what I want to happen:

When Mach encounters an M06 for tool change I want the Z to move up to either the home switch/limit switch/or a predefined machine coordinate high in the Z but I want X and Y to not change.  I would also like a pop up window to display a message with the details of the requested tool (i.e. "Please load tool #3 .5 flat endmill", or "Please load tool #4 3.15 45deg facemill", etc.) and possibly even a photo image of it and a beep or a .wav saying "please load new tool" or something.  I would also like to put a "go to tool change location" button on the program screen that executes this action.


As an aside, how do you control tool #0?  I would like to use T0 for the indicator reference tool but I can't figure out how to use the T0 so I have it as T1.

Thanks for the help
Title: Re: Help with tool changes
Post by: Hood on March 21, 2011, 06:55:48 AM
You would have to enable the Auto Changer option and then write some VB for the M6 macro to do what you want it to do.
Hood
Title: Re: Help with tool changes
Post by: SWATH on March 21, 2011, 09:17:00 PM
Thanks that is what I figured.  Here is what I got to get the z to where I specify on the tool change location DRO.

Z = GetUserDRO( 1202)

code" G53G0 Z" & Z

and I saved it in the M6start.m1s

the problem is that is doesn't stop and wait for the cycle start button to be pushed, it just hits the Z location then proceeds with the program.  What's next?
Title: Re: Help with tool changes
Post by: ger21 on March 21, 2011, 09:46:34 PM
In general config, check "Stop spindle, wait for Cycle Start". This runs the M6 start, then waits for cycle start, then runs m6 end, then continues with the program.
Title: Re: Help with tool changes
Post by: SWATH on March 21, 2011, 10:21:12 PM
Ahh that's perfect, thanks a lot.

So now it goes to Z home and waits for cycle start, so far so good.  Now I would like a pop up dialog box displaying the requested tool info.  I tried getting a dialog box which sort of worked but I couldn't get the tool info.

Something like:

Please change to Tool #4
3.15" 45deg Facemill and
then press cycle start.
           OK
Title: Re: Help with tool changes
Post by: ger21 on March 21, 2011, 10:32:10 PM
In the programmers manual, see the following:
GetCurrentTool
GetSelectedTool
GetToolParam
GetToolDesc

Put the info in a string and display it in a message box.
Title: Re: Help with tool changes
Post by: SWATH on March 22, 2011, 01:31:55 AM
Ok here is what I got so far:

Z = GetUserDRO( 1202)

code" G53G0 Z" & Z

NewTool = GetSelectedTool ()

SetCurrentTool (NewTool)

Message "Please Load Tool #" & GetCurrentTool () & Space (1) & GetToolDesc (GetCurrentTool () )

TNum = GetCurrentTool ()

TDec = GetToolDesc (GetcurrentTool ())

MachMsgTypeOK = 0

Ret = MachMsg ("Please Load Tool #" & GetCurrentTool () & Space (2) & GetToolDesc (GetCurrentTool ()), "Tool Change Rquired", MachMsgTypeOK)



I have a couple of questions I can't figure out. 

!.  How do you Bold text in a message box
2. How do you break a message into 2 lines in a message box?
3. How do you add an image to a message box?
Title: Re: Help with tool changes
Post by: ger21 on March 22, 2011, 06:57:59 AM
1) You can't
2) add a carriage return, don't know it off the top of my head though.
3) You can't, I don't think. You can get different symbols to display. I think the info is in the cypress manual.
Title: Re: Help with tool changes
Post by: SWATH on March 22, 2011, 11:49:36 AM
Ok I got the new line done.  It is disappointing not to be able to insert an image into the text box somehow, there has got to be a work around.

Anyway how do you edit tool #0?  It's there but I can't do anything with it?
Title: Re: Help with tool changes
Post by: SWATH on March 22, 2011, 11:41:45 PM
OK I now have a problem.  The above script works perfectly on my laptop.  However when I run it on my machine computer it does not get the new tool specified in the Gcode it just asks for whatever the current tool is regardless of what the T() is.  What is going on here and how can I fix it?
Title: Re: Help with tool changes
Post by: SWATH on March 23, 2011, 03:07:25 PM
BTW way here is the script.

(http://img838.imageshack.us/img838/5508/toolchangevbscript.jpg)

Its weird it works perfect on my laptop but not on the machine computer although I have the settings the same (as far as I can tell).  The machine computer is not making the requested tool in the Gcode the current tool quick enough for the message to reflect the new current tool and it still asks for the old current tool (whatever the number in the box is).  Anyone know what I can do?
Title: Re: Help with tool changes
Post by: ger21 on March 23, 2011, 06:32:58 PM
SetCurrentTool (NewTool)
Sleep (250)
Message..................


Sometimes you have to wait for Mach3 to update the DRO. This waits 1/4 second. Sleep(1000) = 1 second
It should only take 1/10 second, but I add a little to be safe.

See if this works for you.
Title: Re: Help with tool changes
Post by: SWATH on March 25, 2011, 03:07:16 PM
I tried what you suggested and it pauses for a moment on my laptop and works correctly (as it did before adding the pause).  However it still does not work on the machine computer no matter how long I make the pause.  Could the macro be accessing the wrong database or something?  I did notice I had two macro folders of the same name one with the edited macros and one without, so I tried to delete the one with the stock macros and it wouldn't let be because it said it was in use.  So I closed Mach and deleted it fine.  Then when I reopen mach the macro folder appears again.
Title: Re: Help with tool changes
Post by: ger21 on March 25, 2011, 06:01:06 PM
You're probably editing the wrong macros. The macros mach3 uses are in Mach3\macros\YOURPROFILE\

There's a macro folder for each profile that exists on your computer, but the one that is used has the same name as the current profile.

Sounds like you're editing macros for a profile you're not using, as you appear to be using the mach3mill profile and macros.
Title: Re: Help with tool changes
Post by: SWATH on March 25, 2011, 11:05:10 PM
Well I confirmed that they are the right macros but they still misbehave.