Mach Discussion > Mach4 General Discussion

Button to offset move

(1/2) > >>

ROTM:
Good day.
I've installed a camera and would like to offset to the router.
How it should work ...when I see in the camera a point where id like to drill something.
Press button and the router will move to this point.(let say the offset is x2,y2)

I looked at several post and came to these 2
local inst = mc.mcGetInstance();
mc.mcCntlGcodeExecute (inst, "G52 X2 Y2");

or
local inst = mc.mcGetInstance() mc.mcMdiExecute(inst, “G52 X2 Y2”)

Will these work or am I missing something?

Thank you!

Cbyrdtopper:
I don't use G52, but from my understanding it is a shift from the current work offset.
So unless you are going to set the work offset at your camera point, I'm not sure this will do what you want.
If you want to just move the router when you are at your camera point... you can use the mdi execute command with this code:
mc.mcMdiExecute(inst, "G91 G00 X2.00 Y2.00)
mc.mcMdiExecute(inst, "G90")

G91 is incremental... it is also modal.  Be sure to have the G90 line after your move to put it back into absolute instead of keeping it in incremental or you'll really get messed up.

Bill_O:
i use a head shift for different tools on the head.

mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_X, 0.000) --head shift to 0.000 in x
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_Y, 0.000) --head shift to 0.000 in y
instead of 0.000 put the distance you need from the spindle to the camera
then do a g0 to the position the head was in


ROTM:
Thanks for the reply I am going to give it try...

How would you do to for instance
you can zero when you are at the desired point in the camera then push the button to run the code to move the bit where the center of the camera was.

but lets say you stop at a certain spot push a button without zero and it will move the bit to the center of the camera....push the same button again and now it moves the center of the bit where the camera was....like reversing the position...man I am tired of reading...lol

Thank you!

Graham Waterworth:
You could set a button to set X & Y axis to the offset values and move to the position with a something like :-

Put this in the button scrip:-

Code "G92 X2. Y2." (set axis to new values)
Code "G00 G90 X0 Y0" (move to zero)

Navigation

[0] Message Index

[#] Next page

Go to full version