Table of contents |

KMotionCNC Fiducial Alignment

Fiducial Alignment using the external example C# program first added in KMotion Version 4.33l and located at <Install>\PC VCS Example\MeasureFiducials.

Fiducial Alignment Screen

See video:

Measure Fiducials creates and overwrites the Geometric Correction file named:

<Install Directory>\KMotion\Data\FiducialsMap.txt

This should be configured for KMotionCNC to use in the KMotionCNC | Tool Setup | Tool Setup Files configuration page as shown here:

Tool Setup

The created Geometric Correction File of 2x2 grid points in the form shown below. The table maps the corrected locations of a simple 1x1 inch square centered on the origin. Note that because the the Geo Correction Transformation extends outside the Grid using the closest Grid's Transformation the size and location of the square is not important.


	2,2

	1,1

	-0.5,-0.5

	0,0,-0.411272,-0.508541,0

	0,1,0.598128,-0.507930,0

	1,0,-0.411883,0.500859,0

	1,1,0.597517,0.501470,0

The Measure Fiducials App loads Settings from a file named :

<Install>\PC VCS Examples\MeasureFiducials\MeasureFiducialSettings.txt

Which has this fixed format (avoid extra spaces or tabs). JogSpeed controls the Jog button speeds in counts/inch for both x and y. Resolution should be set to the same value as in KMotionCNC in counts/inch. If your system has more than one Video Capture Device you can control which is selected with the VideoDevice parameter. Zero would be the first detected. MouseMag adjusts the scale factor between Mouse movement and Axes movement.


	JogSpeed 600

	Resolution 10000 10000

	VideoDevice 0

	MouseMag 0.25

KMotionCNC accepts a Window Event to Re-load the current Geometric Correction File. The C# Measure Fiducials Example finds any open KMotionCNC Window with:


	

	[DllImport("User32.dll", SetLastError = true)]

	public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);

	

	IntPtr KMotionCNCWindow = FindWindow("KMotionCNC", null);

	

	and sends the Window Event to KMotionCNC with:

	

	[return: MarshalAs(UnmanagedType.Bool)]

	[DllImport("user32.dll", SetLastError = true)]

	public static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);

	

	uint WM_COMMAND = 0x0111;

	int ID_ReloadGeoCorrection = 33016;

	PostMessage(KMotionCNCWindow, WM_COMMAND, ID_ReloadGeoCorrection, 0);