Machsupport Forum

Mach Discussion => FAQs => Topic started by: Sandro on September 30, 2017, 10:37:39 PM

Title: M6 End
Post by: Sandro on September 30, 2017, 10:37:39 PM
Hello Everybody,

I'm not completely new to mach3 but it is the first time asking a question as I cannot find anything to my problem. I also believe that it will be an easy fix by looking at all that knowledge out there.

Anyway. All what I want to do is to make my cnc to go to the next g-code line after a tool change rather than back to the m6-start starting position. At the moment I achieve that by creating a G0 move to the tool change position before calling a M6 tool change. Pushing START will go straight into the program rather than back to the m6-starting position. The post processor of my CAD/CAM does not add that G0-move automatically so I will have to do that by hand after reading it out.

My machine is homing to X0 Y0 Z0 in the top right corner which I offset with G54 to a plus value referring to the upper limits to my machine (for example G54 X600 Y600 Z200). Doing that will set my 0,0,0 into the front left corner and onto the machine bed. My CAD/CAM is working fine with that setting and I do not have to write minuses when hand coding. There might be a better way of achieving that but so far it worked for me.

My M6-START lookes like that:

code "F7000"
code "G53 Z-0"
code "G53 X-600 Y-600"
tool = GetSelectedTool()
SetCurrentTool( tool )

which will bring my spindle to the front left corner, easy to reach for a tool change.

I have noticed that the M6-END will call the M6-START position to set the tool up for the g-code to follow. I do not want that move and want to go straight into the g-code instead.

Ok, firstly: If there is a sound reason behind that set up move, I would like to know as I cant see one. But there might be something I don't think of, so if so please let me know.
secondly: If there is no sound reason for the doing that move than I would like to change it accordingly as I do believe that it should be easier to change M6-END then changing the post processor to add a G0 move.

Thanks for any answers
Title: Re: M6 End
Post by: joeaverage on October 01, 2017, 01:01:31 AM
not sure I can help, I changed over to Mach 4 so I didn't have to bother with Visual Basic...
If you have a look at the default M6End script you will see the move to the last programmed position before M6Start.
Could you not just delete, or better still comment it out?

Code: [Select]
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
if(IsSafeZ() = 1) Then
   SafeZ = GetSafeZ()
   if  SafeZ  > z then StraightTraverse x, y,SafeZ, a, b, c
      StraightFeed  x, y,  z  , a, b, c
Code"G00 X" & x & "Y" & y
end if

I can think of a few situations where diving into the next lot of code is likely to cause a crash...imagine a line of code
G1 X5 Y5 Z-0.5 F50 immediately after a tool change  at  X0 Y0 Z4, ie work co-ords 0,0 with the tool 4 inches above the material.
The tool will now make a linear move to 5,5,-0.5, ie the cut is going to ramp down. Is that desired behaviour?

It sounds to me like you actually want to go to some location but without cutting, ie at SafeZ height and THEN resume your
Gcode. That's possible but will require some programming and you may find that a modification to your post becomes
attractive again.

Title: Re: M6 End
Post by: Sandro on October 01, 2017, 01:46:58 PM
thanks for the answer joe,

I dont wanna go to a certain position after the tool change accept the next gode.

My tool change happens at the highest Z point and away from any material. After applying the tool offset the machine can go straight into the next line

For example:

m6 t? - tool change @ x0 y0 z0 (x600 y600 z200 in machine coordinates)
g43 h? - apply tool offset without the safe z position
g0 x200 y200 - start position for the next cut
g0 z100 - rapid move to save z
g1 ...... - carry on with the next cut

if I dont put the lines g53 z0 and g0 x0 y0 in front of my tool change the controller automatically goes to the position it came from before the tool change. With a new tool in the spindle that would chrash.

I will play around with a copy of m6-end and try the thing you suggested. I cant really see that that is the answer but I will give it a go. I might also try to put the two line above into the m6-start and see what happens.

Title: Re: M6 End
Post by: ger21 on October 01, 2017, 02:55:02 PM
Just leave your M6End empty.
Title: Re: M6 End
Post by: joeaverage on October 01, 2017, 04:47:45 PM
leaving M6End blank will cause the machine to drive in linear co-ordinated fashion from the toolchange position
to the endpoint of the next Gcode instruction. Is that what you want?

Title: Re: M6 End
Post by: Sandro on October 01, 2017, 06:10:58 PM
Yep that sounds exactly what I want. Didn't know that I could do that as it had other lines in m6end I did not understand. So I wasn't really going to touch it without clarification.

Title: Re: M6 End
Post by: joeaverage on October 01, 2017, 06:21:08 PM
you can comment them out, by adding the commenting the code is still there and you only
have to delete the commenting marks to get it back...if you ever want it.

Title: Re: M6 End
Post by: ger21 on October 01, 2017, 07:20:17 PM
Always make a backup of the file when you make any changes.
Title: Re: M6 End
Post by: Sandro on October 02, 2017, 02:23:52 AM