2281
General Mach Discussion / Re: Auto tool Zero - macro questions
« on: November 07, 2014, 11:00:38 PM »
First, it's really not a good idea to run both inch and mm g-code in Mach3, and expect the auto zero to work in both scenarios.
If you must do this, you're better off to have two separate machine profiles (xml's), one for inches and one for mm's.
My macro is designed to work in both inch and metric modes, because I sell it to people all over the world, and it needs to be reliable for all. But I can tell you that if your machine is set up in inches, and your running metric g-code, problems will occur.
In your macro, you have the plate thickness coded in. You then attempt to change the thickness, based on the current units.
However, your probing moves, and feedrates, are all in inches. To do what your attempting, you'd need to duplicate the entire macro, in both inches and mm's.
Because you are writing the macro for YOU, make it reliable for YOU.
If your Native Units in Mach3 are inches, then force the macro to auto zero in inches.
Check for inches or mm's, and save the value.
Something like:
unitflag = getoemled(801)
Code "G20" ' Set to inches
' Insert macro here
if unitflag = 0 then 'return to metric mode
Code "G21"
end if
This eliminates the need to swap units in your macro.
As for your workflow...
The "Remember" button tells Mach3 to remember your current position, so that you can return to it with the "Return" button later.
Did you intend mean to type "Return" in Step 11? If not, then steps 6 and 11 are doing nothing.
Otherwise, I think it looks OK. But I've never worked like that so I can't be sure. My M6 macro automatically handles steps 7-11. I only need to change the tool.
It sounds like you Z axis is losing position, which has nothing to do with your auto zero macro.
What stepper drives are you using, and what motors and voltage?
What are your velocity and acceleration in motor tuning for the Z axis?
What pitch is the Z axis screw?
Without knowing any of the above information, the first thing I would try is reducing the Z acceleration by 50%.
If you must do this, you're better off to have two separate machine profiles (xml's), one for inches and one for mm's.
My macro is designed to work in both inch and metric modes, because I sell it to people all over the world, and it needs to be reliable for all. But I can tell you that if your machine is set up in inches, and your running metric g-code, problems will occur.
In your macro, you have the plate thickness coded in. You then attempt to change the thickness, based on the current units.
However, your probing moves, and feedrates, are all in inches. To do what your attempting, you'd need to duplicate the entire macro, in both inches and mm's.
Because you are writing the macro for YOU, make it reliable for YOU.
If your Native Units in Mach3 are inches, then force the macro to auto zero in inches.
Check for inches or mm's, and save the value.
Something like:
unitflag = getoemled(801)
Code "G20" ' Set to inches
' Insert macro here
if unitflag = 0 then 'return to metric mode
Code "G21"
end if
This eliminates the need to swap units in your macro.
As for your workflow...
The "Remember" button tells Mach3 to remember your current position, so that you can return to it with the "Return" button later.
Did you intend mean to type "Return" in Step 11? If not, then steps 6 and 11 are doing nothing.
Otherwise, I think it looks OK. But I've never worked like that so I can't be sure. My M6 macro automatically handles steps 7-11. I only need to change the tool.
It sounds like you Z axis is losing position, which has nothing to do with your auto zero macro.
What stepper drives are you using, and what motors and voltage?
What are your velocity and acceleration in motor tuning for the Z axis?
What pitch is the Z axis screw?
Without knowing any of the above information, the first thing I would try is reducing the Z acceleration by 50%.