Page 1 of 1

Internal Variables

PostPosted: Mon Dec 26, 2016 2:39 pm
by camivic
Yes , i know, the topic was extensively discussed, but I continue to have doubts.
Why, after a G31 command, this code always return "X0 Y0 Z0" ?

Code: Select all
exec.Code ("G31 Z" + xxx+ "F" + yyy);

MessageBox.Show("X" + exec.ivars[5061]+ "Y" + exec.ivars[5062]+ "Z" + exec.ivars[5063]);


I need to know the Zmachine value when probe it was activated.

Thanks,

Vincenzo

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 4:29 pm
by ger21
The probe input has to be triggered during the probe move before the vars will contain a value.

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 4:37 pm
by camivic
Sorry, but i don't uderstand!!
After the G31 command, the software return the value of the exactly point (in this case the Z value) where the probe has been triggered.
Or not...

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 5:11 pm
by ger21
Yes, it should.
What version of UCCNC are you using?

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 5:13 pm
by camivic
1.2026 version.
Meanwhile I managed to have the coordinate values, but the Z value is not the same of the ZDRo value displayed on the screen. Why?

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 8:55 pm
by CT63
The latest version is 1.2029.

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 9:04 pm
by cncdrive
camivic wrote:1.2026 version.
Meanwhile I managed to have the coordinate values, but the Z value is not the same of the ZDRo value displayed on the screen. Why?


When you probe with G31 the probed axis moves and you trigger the probe input, then the coordinates are saved inside the motion controller and the axis deccelerates and stops
and the coordinates meanwhile sent to the PC side, so the coordinates are accessible in the #5061 ... variables.
So, the coordinates are not the same in the variable and in the DRO, because the axis has to deccelerate, so the probed point is different from where the axis stops.
This is why you should read the probe coordinates from the # variables and not from the DRO, because the DRO will differ with the decceleration distance while the #var probe position will be very precise.

Re: Internal Variables

PostPosted: Mon Dec 26, 2016 9:52 pm
by A_Camera
camivic wrote:Yes , i know, the topic was extensively discussed, but I continue to have doubts.
Why, after a G31 command, this code always return "X0 Y0 Z0" ?

Code: Select all
exec.Code ("G31 Z" + xxx+ "F" + yyy);

MessageBox.Show("X" + exec.ivars[5061]+ "Y" + exec.ivars[5062]+ "Z" + exec.ivars[5063]);


I need to know the Zmachine value when probe it was activated.

Thanks,

Vincenzo

Vincenzo,
After a move command you have to add a wait loop like this:

Code: Select all
exec.Code ("G31 Z" + xxx+ "F" + yyy);
while(exec.IsMoving())
{
   exec.Wait(100);
}
MessageBox.Show("X" + exec.ivars[5061]+ "Y" + exec.ivars[5062]+ "Z" + exec.ivars[5063]);


If you don't do that then the variables are displayed before the G31 execution is done.

Re: Internal Variables

PostPosted: Thu Jan 05, 2017 6:06 pm
by Battwell
I made some notes on my findings in the auto zero thread
Getting same results using var or not

Re: Internal Variables

PostPosted: Mon Jan 09, 2017 7:56 am
by A_Camera
Battwell wrote:I made some notes on my findings in the auto zero thread
Getting same results using var or not

If you probe slowly then the results are the same. Increase the speed and you will notice the difference.