Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: stevehuck on September 05, 2023, 05:04:23 PM

Title: Set Tool Number in Gcode?
Post by: stevehuck on September 05, 2023, 05:04:23 PM
Is it possible to set the tool number in Gcode? I have been searching all the docs and it seems like the answer is no.

I run my program the first time and tool number is one. Stops for the tool change (T2 M6) and tool number changes to 2. Awesome
Run the same program the second time. Tool number is still 2. Ignores the tool change because tool number matches the tool needed.
Added an unwanted tool change (T1 M6) so now i have to click cycle start twice every time i run after the first time to change the tool number back to 1.
Edited the M6 script forcing the stop at all M6 commands so no tool change is ignored. Awesome
Now the tool number is always 2.

I can live with that because it funtions the way i want it to. But thought I would ask. Is there a way to reset the tool number using a Gcode command? This way I could put the M6 macro back together, set the tool number to match the first tool in all my code, and skip the first tool change and not have to click twice!

But I think i already know the answer.
Title: Re: Set Tool Number in Gcode?
Post by: Bill_O on September 05, 2023, 05:38:22 PM
I think you can just click on the tool number and type the tool you want then hit Enter
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 05, 2023, 05:51:17 PM
Yeah I realize that but if i forget to do that and that #2 tool change gets skipped I have a ruined part. I'll just have to find a way to ignore the display.
Title: Re: Set Tool Number in Gcode?
Post by: smurph on September 05, 2023, 06:41:07 PM
I'm fixing to add M61 as a means to do just this.  I'll post when there is a build up with this in it. 

Steve


Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 05, 2023, 07:09:09 PM
That would be great. I have to learn Lua. So many things would be doable if i had a good understanding
Title: Re: Set Tool Number in Gcode?
Post by: Bill_O on September 06, 2023, 08:37:27 AM
Steve,

I am not a programmer and it took me a little while to get the hang of the LUA.
I put this together to help other people.
https://www.machsupport.com/forum/index.php?topic=45397.msg289143#msg289143

Bill
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 06, 2023, 09:12:26 AM
Thank you. I'll take a peek later today after I get my chores done.
Title: Re: Set Tool Number in Gcode?
Post by: smurph on September 06, 2023, 06:08:44 PM
Build 5194 is up with M61 in it.  Check the docs on how to use it.  Basically M61 Q1.  Q sets the tool number.  Q0 means no tool installed. 

Steve
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 06, 2023, 06:27:07 PM
Awesome thank you
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 06, 2023, 06:36:24 PM
Just checked 2.0.5036 is up on the site. Can't find anything about 5194. Where should I look?
Title: Re: Set Tool Number in Gcode?
Post by: thosj on September 06, 2023, 07:14:04 PM
On the FTP page, development versions. It's quirky in any browser I use, but hover over the Mach4Hobby versions and you'll see the version in the status line. It'll be the last Mach4Hobby one at the moment, until a newer version comes out!!!

https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 06, 2023, 07:55:38 PM
Didn't work. I put "M61 1" in as the first line. Ran the code and changed to tool 2 and program ended

Ran again and the tool number never changed back to tool one and never stopped for the tool change. Drotoolnumber stays number 2.
Title: Re: Set Tool Number in Gcode?
Post by: thosj on September 06, 2023, 07:58:35 PM
Did you mean M61 Q1?
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 06, 2023, 08:10:24 PM
I do now lol. Went back and read the docs again and realized I missed the Q. All good now. Works like I was hoping it would. Now I can change my M6 macro back to original. Thank you!

Quick question!  Does the screen load file always get overwritten when installing a newer version. I'm going to install this tomorrow and I'll have to edit it again to get my cycle start button working again.
Title: Re: Set Tool Number in Gcode?
Post by: smurph on September 07, 2023, 12:23:00 AM
It is on the FTP site with the development versions.

https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/Mach4Hobby_Installer-4.2.0.5194.exe (https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/Mach4Hobby_Installer-4.2.0.5194.exe)

Here is the directory for future reference.  https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/ (https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/)

Steve


Title: Re: Set Tool Number in Gcode?
Post by: smurph on September 07, 2023, 12:27:13 AM
Quick question!  Does the screen load file always get overwritten when installing a newer version. I'm going to install this tomorrow and I'll have to edit it again to get my cycle start button working again.

You should install a new profile based off of the stock profiles.  If you edit the screen, you should rename it in the screen's properties.  Or else, yes, it will get overwritten with new version installs.  There is a whole post on this forum about all of that stuff somewhere.  Maybe someone will link it if I can't find it. 

Steve
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 07, 2023, 04:40:33 AM
I do have new profiles with custom names but still had to edit to enable my cycle start button. Oh well thanks again. Now if I could jog from the keyboard on startup this setup will be perfect.

I bookmarked the ftp page incase something I didn't know I needed gets implemented.  Thanks again.
Title: Re: Set Tool Number in Gcode?
Post by: stevehuck on September 07, 2023, 05:44:10 PM
Just wanted to come back and say thanks. Mill ran a dozen parts and was flawless. Acted exactly as I wanted it to. Thank you for all your help.
Title: Re: Set Tool Number in Gcode?
Post by: smurph on September 12, 2023, 05:21:17 PM
 Awesome!  You are most welcome.  :)