Page 1 of 1

Zero Work Offsets using Probe

Posted: Thu May 17, 2018 6:58 pm
by EondeK
Hi

I need to implement a probe function which sets the axes offsets in G54 or whatever offset is currently selected. I could not find any info in the manual. I did find a post referring to example KflopToKMotionCNCFuntions.c and using DoPCFloat(PC_COMM_SET_X,0.0). However this seems to apply to a global offset and not the G54 or G55 work offsets.

I envisage the following steps:
1) Manually select the appropriate work offset on the screen (G54, G55 etc)
2) Click a button on the screen to trigger the probe operation. This will jog the axes to det the probe to touch while watching the I/O pins.
3) After the probe touches I need to
a) Determine which is the current work offset selected on the screen. How
do I need to do that?
b) Read the current value of the axis in G53. I suppose I can use
ch0->OffsetPosition=Position to read the position into variable
OffsetPosition?
c) enter the value of the OffsetPosition for the axis in the selected work
offset.
I will really appreciate assistance with the code to implement this.
Regards

Re: Zero Work Offsets using Probe

Posted: Thu May 17, 2018 7:14 pm
by TomKerekes
Hi EondeK,

DoPCFloat(PC_COMM_SET_X,0.0); Should perform the same operation as the "Set" button on the main KMotionCNC Screen. The "Set" button on the KMotionCNC Screen can be configured to either change the current fixture offset or the global G92 offsets. Which do you have KMotionCNC configured to change? See:
http://dynomotion.com/Help/KMotionCNC/T ... re_Offsets

The simplest thing would be for you to use that option if it works for you.

HTH

Re: Zero Work Offsets using Probe

Posted: Thu May 17, 2018 8:11 pm
by EondeK
Thanks Tom

I see the current setting for the SET button is to change the global G92 so I will then just change that and give it a try.

Rgrds

Re: Zero Work Offsets using Probe

Posted: Sat May 19, 2018 3:14 pm
by EondeK
Hi

I changed the setting on the Trajectory screen to ensure the Set button changes the fixture offset. This works and when I move the axis and press the set button, the change is reflected in the selected offset which was G54.

But when I run the program using DoPCFloat(PC_COMM_SET_X,0.0) then it changes the G92 global offset and not the Fixture offset. How can I fix that?

Regards

Re: Zero Work Offsets using Probe

Posted: Mon May 21, 2018 5:43 pm
by TomKerekes
Hi EondeK,

I'm sorry for missing this post and misleading you. You are correct the PC_COMM_SET_X command always changes the G92 offset.

The Fixture Offsets are saved in the GCode Vars and can be modified there. There is a SetFixtureZ.c example of how to do this. I've also pasted it below.

Code: Select all

#include "KMotionDef.h"

#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"

#define Zaxis 2

main()
{
	int FixtureIndex;
	double NewOriginOffset,OriginOffsetZ;
	double DROx, DROy, DROz, DROa, DROb, DROc;

	GetFixtureIndex(&FixtureIndex);

	GetOriginOffset(&OriginOffsetZ, FixtureIndex, Zaxis);

	GetDROs(&DROx, &DROy, &DROz, &DROa, &DROb, &DROc);
	
	// Adjust Origin Offset to make DRO zero
	NewOriginOffset = OriginOffsetZ + DROz;

	SetUserDataDouble(TMP,NewOriginOffset);
	SetVars(5201+FixtureIndex*20+Zaxis, 1, TMP);

	DoPC(PC_COMM_UPDATE_FIXTURE);
}
HTH

Re: Zero Work Offsets using Probe

Posted: Tue May 22, 2018 8:31 pm
by EondeK
Thanks Tom, I should have checked. I converted the C programs to functions and then I could just call them from the homing program to set the fixture offsets. Just a few lines of code.

Re: Zero Work Offsets using Probe

Posted: Tue Jun 19, 2018 8:55 am
by mlinka
Hy, can you share the C program for touch probe?
Thank you.