Page 1 of 1

How to get WCS axis position in PLC program?

Posted: Sun May 30, 2021 2:40 am
by ashesman
I would like to read axis position in the current work coordinate system in the PLC program. I can see special variables for absolute encoder position but none for calibrated WCS position. They are probably right there but my brain is starting to fail me tonight!

The application is: I have three buttons on my control panel Set X0, Set Y0, Set Z0. Each button has a light. I want to light the button for each axis when the machine is at (near) zero relative to the current WCS.

I will only light them in manual mode so they dont flash every time an axis passes 0 while running a program!

example pseudo code:

IF ManualMode && XPos <= 0.002 && XPos >= -0.002 THEN (SetX0ButtonLight_O)

Re: How to get WCS axis position in PLC program?

Posted: Sun May 30, 2021 1:48 pm
by cncsnw
There are no such variables.

You would have to use some opportunity -- e.g. the running of CNC macros you have mapped to those Aux keys -- to store the WCS zero offsets, perhaps converted to encoder counts, into Machine Parameter values. The PLC program can then read those machine parameters and compare to the current encoder positions.

Of course, the parameters would not be updated when you changed coordinate systems (G55, G56, G57...) without running your set-zero macros again.

Re: How to get WCS axis position in PLC program?

Posted: Mon May 31, 2021 2:16 am
by ashesman
Bugger... it seems like a really useful variable to have access to in the PLC program. Could be good for all sorts of things.