In <CAJZ=BTNHivrbVW_8MR-aD0rtxE+=sqisfunmhdbcwog1vfw...@mail.gmail.com> Andrew 
<[email protected]> writes:

>Is there a pin for machine/relative position?
No, but you can create your own pin for the axis gui
using python statements in  ~/.axisrc

Example:
#--------------------------------------------------------
$ cat ~/.axisrc
mycomp = hal.component("mycomp")
mycomp.newpin("coord_relative",hal.HAL_BIT,hal.HAL_IN)
coord_relative = vars.coord_type.get()

def user_live_update():
    global coord_relative
    coord_relative_pin = mycomp["coord_relative"]
    if (coord_relative != coord_relative_pin):
        vars.coord_type.set(coord_relative_pin)
        coord_relative = coord_relative_pin
        o.tkRedraw()

#--------------------------------------------------------
$ # Testing:
$ linuxcnc yourinifile.ini &
$ halcmd show pin mycomp
Component Pins:
Owner   Type  Dir Value  Name
    72  bit   IN  FALSE  mycomp.coord_relative
$ # test using sim_pin (toggle):
$ sim_pin mycomp.coord_relative &

#-----------------------------------------------------------------------
Notes:
1) Future changes to the axis gui may break this method.
2) Using the axis gui key ("#") that is bound to the
   commands.toggle_coord_type() function will override
   the current mycomp.coord_relative hal pin setting

#-----------------------------------------------------------------------
References (for 2.7.x LinuxCNC version):

~/.axisrc:
http://linuxcnc.org/docs/2.7/html/gui/axis.html#_axisrc

user_live_update():
http://linuxcnc.org/docs/2.7/html/gui/axis.html#_user_live_update

sim_pin:
http://linuxcnc.org/docs/2.7/html/man/man1/sim_pin.1.html

Alternatively, the statements shown above for ~/.axisrc
can be placed in a configuration-specific  file defined
by [DISPLAY]USER_COMMAND_FILE, see:

http://linuxcnc.org/docs/2.7/html/gui/axis.html#_user_command_file
-- 
Dewey Garrett


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to