Camera and laser offset, and finding center between 2 points

Good day.
I finally installed a small microscopic camera on the machine.(i will probably set a laser crosshair as well in the future)
Where can I find info on setting the offset between the center of the microscope to the router, plasma and laser?

Also If I have 2 points …let say I move the machine to a point then to another…what would be the fastest way to get the center…

In example set 2 points > click a programmed button and it will move the machine to the center of those points. (this would be a great time saver)

Thank you!

I think what you’re looking for is a G52 shift:

Check that document for it. This will shift the coordinate system away from the spindle coordinates whatever amount you want.

A technique you could use is to zero XY on a point and then put your camera on that same spot and G52 offset whatever amount you have travelled to get there.

What camera are you using?

I bought a supereyes camera…

I am trying to do this as well… Quicktip Mach4: Kamera und Mikroskop anschließen (youtube.com)

I managed to get the camera working in Mach4 after hours of trying …rebooted windows and now it shows :confused:
Now I need to figure out how to program these buttons…

1 Like

You can do an offset as Eric said, or you can write a function that adds an offset to your X, Y, and Z offsets if you want. That is how I do it for my laser’s touchplate rod. I run the touchplate routine on the rod thats mounted to my laser head, and then run the offset code that just adds the offset between where the rod is and the laser beam (which i have gotten through characterization).

The function code is:


– This function is used to set X, Y, and Z offsets from a probe that is offset
– from the actual tooling. First you use a touchplate and a probe to set the offsets to that reference,
– and then you run this function to adjust the work coordinates with respect to the probe to tooling offset.
– In the case of a laser, there is an additional Z parameter called focus offsets that lets you enter
– an additional offset to adjust focus height. This value is just added to the other Z offset, but it allows
– the user to set a fixed offset for the probe offset, and then just adjust the focus parameter based on the job’s
– beam requirements.
– NOTE: This Function should be executed AFTER the touchplate is used to set the Z of the Laser nozzle.

function SetOffsetsforLaser()
local inst = mc.mcGetInstance(“SetOffsetsforLaser()”)

if not (pf.IsHomed()) then
wx.wxMessageBox("Machine is not homed, it is not safe to perform this move")
do return end
end	

–Get DRO settings
local XOffset = scr.GetProperty(‘droOffsetX’, ‘Value’) --gets dro
XOffset = tonumber(XOffset) --convert string to number

local YOffset = scr.GetProperty('droOffsetY', 'Value') --gets dro
YOffset = tonumber(YOffset)  --convert string to number

local ZOffset = scr.GetProperty('droOffsetZ', 'Value') --gets dro
ZOffset = tonumber(ZOffset)  --convert string to number

local LaserFocusHeight = scr.GetProperty('droLaserZ', 'Value') --gets dro
LaserFocusHeight = tonumber(LaserFocusHeight)  --convert string to number

–Check that DRO settings are valid
if ((XOffset < -5) or (XOffset > 5)) then --check for valid XOffset. Adjust as needed for your machine
wx.wxMessageBox(“X Offset must be between -5 and +5”)
do return end
end

if ((YOffset < -5) or (YOffset > 5)) then  --check for valid YOffset.  Adjust as needed for your machine
wx.wxMessageBox("Y Offset must be between -5 and +5")
do return end
end	

if ((ZOffset < -5) or (ZOffset > 5)) then 	--check for valid ZOffset.  Adjust as needed for your machine
wx.wxMessageBox("Z Offset must be between -5 and +5")
do return end
end	

if ((LaserFocusHeight > 0) or (LaserFocusHeight < -0.500)) then --check for valid Laser Focus height
wx.wxMessageBox(“Laser Focus Height must be <= Zero and > -0.500”)
do return end
end

–Print out values in log history
mc.mcCntlSetLastError(inst, "**** X Offset is: " …XOffset)
mc.mcCntlSetLastError(inst, "**** Y Offset is: " …YOffset)
mc.mcCntlSetLastError(inst, "**** Z Offset is: " …ZOffset)
mc.mcCntlSetLastError(inst, "**** LaserFocusHeight is: " …LaserFocusHeight)

–set new X Work Coordinates
local CurrentWorkCoordXAxis = mc.mcAxisGetPos(inst, mc.X_AXIS) --Get current X axis work coord
CurrentWorkCoordXAxis = tonumber(CurrentWorkCoordXAxis) --Convert string to number
mc.mcCntlSetLastError(inst, "**** Current X Axis Work Coordinate is: " …CurrentWorkCoordXAxis)

local NewWorkCoordXAxis = CurrentWorkCoordXAxis + XOffset
mc.mcCntlSetLastError(inst, "****   Setting New X Axis Work Coordinate to:   " ..NewWorkCoordXAxis)

mc.mcAxisSetPos(inst, mc.X_AXIS, NewWorkCoordXAxis)

–set new Y Work Coordinates
local CurrentWorkCoordYAxis = mc.mcAxisGetPos(inst, mc.Y_AXIS) --Get current Y axis work coord
CurrentWorkCoordYAxis = tonumber(CurrentWorkCoordYAxis) --Convert string to number
mc.mcCntlSetLastError(inst, "**** Current Y Axis Work Coordinate is: " …CurrentWorkCoordYAxis)

local NewWorkCoordYAxis = CurrentWorkCoordYAxis + YOffset
mc.mcCntlSetLastError(inst, "****   Setting New Y Axis Work Coordinate to:   " ..NewWorkCoordYAxis)

mc.mcAxisSetPos(inst, mc.Y_AXIS, NewWorkCoordYAxis)

–Set new Z work coordinates
local CurrentWorkCoordZAxis = mc.mcAxisGetPos(inst, mc.Z_AXIS) --Get current Z axis work coord
CurrentWorkCoordZAxis = tonumber(CurrentWorkCoordZAxis) --Convert string to number
mc.mcCntlSetLastError(inst, "**** Current Z Axis Work Coordinate is: " …CurrentWorkCoordZAxis)

local NewWorkCoordZAxis = CurrentWorkCoordZAxis + ZOffset + LaserFocusHeight
mc.mcCntlSetLastError(inst, "****   Setting New Z Axis Work Coordinate to:   " ..NewWorkCoordZAxis)

mc.mcAxisSetPos(inst, mc.Z_AXIS, NewWorkCoordZAxis)

end

1 Like

Thank you…I am going to give it a try…I am almost where I want to be with this machine…so I can try the rotary

I got it working in the most basic way…I will try to use someparts of the code as I not need to use z values…trying to learn here…trying to figure out how to save and run stored points which I think is in the above code…
on top of that my Mach4 in edit mode is lagging badly so everything takes about 4 times longer lol.

Below a pic of the working cam and the setup where I would like to have in the end.


1 Like

Well this is a cool project.Thanks for posting it. I need to be able to do something similar I wonder if it’s possible to use a camera setup locate 2 points and do a g68 to rotate the cut data to match the angle of the part being cut? Hopefully that makes sense.

Yes it is. As a friend I used to work with would say, its just SMS (Simple Matter of Software). However, for some of us (me) software isn’t always simple, but at least its fun working on features like this. I have used the g68 to do a simple 90 degree rotation for long skinny projects (like a sign) where I want to design horizontally in Vectric, but want to cut it down my Y axis. I put a button in my screen for that and then it redraws the toolpath as well.
If you are manually jogging the camera crosshairs to the targets, its easy to capture the current position (and apply the offsets between the camera and spindle center). If you want it fully automated where the thing searches for the marks and locates them automatically, thats a lot more challenging.
I am following this project too because I’m thinking this might be a nice way to set zeros when you don’t need much precision, especially in the middle of a project.

Hello there,

I am loving these insights mate as I found it very much useful and informative to be honest also as a new member I am loving this community so far. Looking forward for more such discussions.

1 Like

Well I decided my fix was to buy a smaller machine for 3x the cost. Kind of joking? We bought a Summa F1612 as a in between machine. High Freq router ($27000!?!).
2 Tangential modules, several different cutters including an electric oscillating tool. It opens up some of the same doors we were using but without it needing to be me running it all the time. I don’t know that I will run MDF on it or not, it’s close to a flatbed printer that doesn’t like dust. Its main job will be cutting cardboard and stickers.