Hi,
OK you don't really care about machine coordinates. To be honest I think that is a mistake. I used to have a few
crashes until I fitted Home switches and 'took control' of my machine coordinates and have had only one crash in the four
years since.
p.s. i DO have a coordinate DRO in mach3, but never look at it.
You have the same in Mach4. See the pic attached.
What you really require is when you turn on Mach (and enable it) that the machine 'Homes in Place' and then
applies a work offset so that your DROs read 0,0,0.2
Here is some code to do it:
function m666()
local inst=mc.mcGetInstance()
mc.mcAxisDerefAll(inst)
mc.mcAxisSetHomeInPlace(inst,mc.X_AXIS,1)
mc.mcAxisSetHomeInPlace(inst,mc.Y_AXIS,1)
mc.mcAxisSetHomeInPlace(inst,mc.Z_AXIS,1)
mc.mcAxisHomeAll(inst)
mc.mcAxisSetPos(inst,mc.X_AXIS,0.0)
mc.mcAxisSetPos(inst,mc.Y_AXIS,0.0)
mc.mcAxisSetPos(inst,mc.Z_AXIS,0.2)
end
if (mc.mcInEditor()==1) then
m666()
end
By way of explanation;
mc.mcAxisDeRefAll() dereferences any axis that happens to be already homed, unlikely at start up but just to be sure....
mc.mcAxisSetHomeInPlace() just is to make sure that your machine can home in place, I know that you don't have home switches
so the machine should therefore home in place by default.....its just the 'fault' part of 'default' that I don't trust!
mc.mcAxisHomeAll() will now cause your machine to be referenced TO ITS CURRENT LOCATION. Thus if you were to look at the
machine coordinates you would see that the position 0.2 above the corner of your vice will be 0,0,0 (machine coordinates)
mc.mcAxisSetPos() sets the DRO and implies a matching work offset.
This code should be in Mach4Hobby/Profiles/<your profile name>/Macros as:
m666.mcs The reason for the m666 is because its 'devil' code, to be used at your own risk
You could open the Zero Brane editor, paste the code in and then <save as> and browse to your profiles macro directory.
The last thing you need to do is ensure that the macro will run at start up, or more specifically the initial Enable of
Mach after start up. This has been provided for in Configure/Control/General/Initialisation Codes.
Craig