Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Bob La Londe on July 14, 2013, 10:46:50 PM

Title: M6 Macro Help
Post by: Bob La Londe on July 14, 2013, 10:46:50 PM
This is what is in the default m6 start macro. 

tool = GetSelectedTool()
SetCurrentTool( tool )

I found this to be quite helpful as an alternative:

code "m9"
code "m5"
code "G28"
tool = GetSelectedTool()
SetCurrentTool( tool )
code "m1"

I just need to figure out how to implement G43 h(x) and apply the tool offset from the tool table for the new tool. 

Can somebody point me in the right direction? 




Title: Re: M6 Macro Help
Post by: Bob La Londe on July 14, 2013, 11:29:21 PM
Doh!

Contents of M6Start.m1s

Code "m9"
Code "m5"
Code "g28"
Code "m1"
tool = GetSelectedTool()
SetCurrentTool(tool)
Code "g43 H" & tool

Problem solved. 

Title: Re: M6 Macro Help
Post by: Bob La Londe on July 15, 2013, 01:50:14 PM
I am having some problems getting my mind wrapped around the tool offsets and the tool table.  It seems simple, but doesn't seem to work for me.  I am abandoning the G43 H(x) stuff for now.  

Just going with this for now:

Code "m9"
Code "m5"
Code "g28"
Code "m1"
Title: Re: M6 Macro Help
Post by: Graham Waterworth on July 16, 2013, 03:43:06 AM
I am not sure what it is you are trying to do, G28 on its own will do nothing useful it needs an axis commanded with it, e.g. G28 X0 or G28 Z0 to tell it which axis to home not only that but you would normally have the machine in G91 mode to stop it rapiding via the datum point first.

A normal G28 command would look something like this :-

G91 G28 X0 Y0 Z0

This will send all 3 axis to the home position in one direct move.

G90 G28 X0 Y0 Z0

Will move to the home position by going to the current XYZ zero point first then to the machines home position.

You can also use G91.1 with G28 to search for the home position.

Title: Re: M6 Macro Help
Post by: Bob La Londe on July 16, 2013, 10:06:13 AM
Well it does do some thing.  With 12 2 0 set as the G28 position on the homing and limits page it goes to machine position 12 2 0.  This is a very convenient location to do a tool change.  It works that way.  I have tested it and it works. 
Title: Re: M6 Macro Help
Post by: Graham Waterworth on July 16, 2013, 10:28:44 AM
 :o

Title: Re: M6 Macro Help
Post by: Bob La Londe on July 16, 2013, 10:59:28 AM
What I am trying to do is get this bit to work properly to change the indicated tool and the tool offset automatically with just an T(x) M6 command in the G-code.  This would be a superior solution to modifying my post processor to generator the extra code for tool changes. 

tool = GetSelectedTool()
SetCurrentTool(tool)
Code "g43 H" & tool

I think my problem was some confusion in setting up the tool offset table.  I think that snip of code works, but I had my tool table setup wrong.  If I have time I'll do some experiments today, but I need to make some parts first. 

As to the bit about G28 ~ Tormach shows it in their tool table setup videos also.  Interestingly they say you have to set it in on the settings page.  There is a place to enter a G28 position on the settings page, but it didn't work for me.  When I set it on the homing and limits page it worked perfectly. 
Title: Re: M6 Macro Help
Post by: Bob La Londe on July 16, 2013, 12:03:59 PM
I do need to ask.  Was the surpsied face icon because I told you something you didn't know, or because my machine and setup is doing something it shouldn't? 
Title: Re: M6 Macro Help
Post by: Graham Waterworth on July 16, 2013, 04:16:08 PM
All I will say is, don't expect future versions of Mach to work that way.
Title: Re: M6 Macro Help
Post by: ger21 on July 16, 2013, 04:33:17 PM
As long as there's a new manual to explain how it will work.
Right now it works as the manual says it should.
Title: Re: M6 Macro Help
Post by: Bob La Londe on July 16, 2013, 04:36:22 PM
All I will say is, don't expect future versions of Mach to work that way.

Ok...  I tested it on my machine, and on my desktop that has no machine connected.  It seemed to work the same way on both.  I think my desktop has the latest version of 3 as I had to nuke the computer (ice virus) and reinstall just a week or so ago.  It is also the way Tormach documents to setup their machines, so its not something new I just discovered.  G28 to preposition for a tool change. T(x) M6 G43 H(x) to perform the tool change.  

G28 is defined in the Mach 3 descriptions as "To return to a home position by way of the programmed position," and "If no axis words are programmed, the intermediate point is the current point."  On the homing and limits page there is a place to enter the G28 position.  Based on the documentaiton it sounds like its doing exactly what its supposed to.  I do have safe Z turned on.  I suppose it would go directly to that position and risk crashes into clamps etc if I did not, but otherwise it seems like its doing what is described.  

Are you saying that I have grossly mis-interpretted the documentation, or that you are redefining the meaning of G28 in future versions?  





Title: Re: M6 Macro Help
Post by: Bob La Londe on July 16, 2013, 04:47:16 PM
I had not used G30 before, but based on this thread I decided to see what it does.  G28 seems to utilize a safe Z, and G30 seems to go directly to home without utilizing a safe z move.  Otherwise they both rapid the machine to the programmed position when no axis words are used.  (I have not tried it on a machine where safe Z is not programmed.)