Hello Guest it is April 24, 2024, 11:58:04 AM

Author Topic: Laser pointer, offset X-Y and set zero but whitout moving the tool incremental  (Read 299 times)

0 Members and 1 Guest are viewing this topic.

Hello guys,

I use a laser pointer (precise enough for my need) to set my X and Y origin, I know I can move X 3.00 and  Y 4.00 incremental and set the zero for G54 X and Y. But sometimes, I can't move because my tool will contact the part (4 axis head)

So, I'd love to create a script that once I lined up the laser with my mark for the X and Y origin, the script would note the actual machine position for the x and y value, add the 3.00 for the X and add 4.00 for Y and set the result as the zero position for G54 X and Y

Thanks a lot guys for the help!
Hi,
yes, thats pretty straight foward, I'd use this API:

Code: [Select]
LUA Syntax:
rc = mc.mcAxisSetPos(
number mInst,
number axisId,
number val);

Description:
Set the Position of an axis by changing the fixture offset.

Parameters: Parameter Description
mInst The controller instance.
axisId The axis ID for which to set the position.
val The axis position (in user units).


Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
MERROR_AXIS_NOT_FOUND The axis specified by axisId was not found.

Notes:
Set the position of the axis by changing the current Fixture offset. This is not valid for out of band axes.


Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Hi,
I would suggest that you instantiate two registers X_AXIS_OFFSET, and Y_AXIS_OFFSET and make them persistent.
That will allow you to populate both registers with the exact offset for each axis. It might be for instance that you intended the X axis offset to be
3 inches , but when its all bolted in place its 3.024 inch, well that's OK just put the the correct and exact number in the register.

Now you write a macro that zeros the X and Y axes combining the two registers using the API above.

Mach4 has built in macros so clearly you don't want to overwrite any of those. I make it a rule that any of my own macros are m100() or above,
and then I can be reasonably sure that none of my macros will clash with any internal macros.

Can you tell me what axis no. you have assigned the X and Y axes to?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'