Machsupport Forum

Mach Discussion => Mach4 General Discussion => Mach4 Toolbox => Topic started by: ahmad1222 on September 15, 2020, 03:42:12 PM

Title: problem about tool change M6
Post by: ahmad1222 on September 15, 2020, 03:42:12 PM
hello every one
so my problem is when i call M6  command (lets say the current tool is 1 and i want to change to tool number 2 ) and when it move too return  the current  tool 
and lets say some one accidental  press stop the machine will stop and set the current tool to 2 even so it didn't change the tool
is there any thing to tell me that stop is pressed so i can have an if statement to to avoid this
Title: Re: problem about tool change M6
Post by: Graham Waterworth on September 15, 2020, 05:00:41 PM
You need to put your M6Start.m1s on here for us to look at but rename it to ahmad1222.m1s so you do not get a error message saying already exists.
Title: Re: problem about tool change M6
Post by: ahmad1222 on September 16, 2020, 03:33:07 AM
here is the code
Title: Re: problem about tool change M6
Post by: joeaverage on September 16, 2020, 06:23:12 AM
Hi,
not quite sure what you guys are on about, files of type .m1s are for Mach3. This is a Mach4 board.

Lua source files are of type .mcs and compiled Lua files are of type .mcc.

Additionally its normal in Mach3 to have an M6Start script but not so in Mach4.

If your script is compiled VB then it won't run in Mach4.......Mach4 uses Lua 5.3 for scripting.

Craig
Title: Re: problem about tool change M6
Post by: ahmad1222 on September 16, 2020, 07:12:20 AM
The file extension is .mcs then it compiled to .mcc
I program it in Lua
But I upload it with the extension you ask
Last I am working with mach 4
Title: Re: problem about tool change M6
Post by: Graham Waterworth on September 16, 2020, 09:56:57 PM
My mistake, I was thinking it was Mach3.
Title: Re: problem about tool change M6
Post by: ahmad1222 on September 17, 2020, 03:44:23 AM
No Problem so do you have any ideas ?
Title: Re: problem about tool change M6
Post by: Graham Waterworth on September 17, 2020, 09:43:11 PM
It looks like the macro needs some flags to set as things happen so on exit it knows it completed the change, start a counter as the first thing and then at every stage increment it by 1 for moves open and close tool clamp etc. then when the macro exits check the value and see if its done all the steps.
Title: Re: problem about tool change M6
Post by: ahmad1222 on September 20, 2020, 07:19:28 AM
i have try your idea but it doesnt work
as i press stop the tool change the number
i am thinking about to put a code in the PLC Script if the stop pressed and the machine doesn't change the tool it will undo any change