Keyboard re-mapping (key binding)

More
08 Nov 2011 17:49 #14686 by ioiotutu
Replied by ioiotutu on topic Re:Keyboard re-mapping (key binding)
here is a scheme.
Attachments:

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 19:01 #14690 by BigJohnT
Replied by BigJohnT on topic Re:Keyboard re-mapping (key binding)
Ok, that makes sense the machine is correct but you don't stand in the conventional position. Have you give any thought to using a joy pad to jog with instead of lugging the keypad to the machine? Otherwise you would have to modify axis.py to change the key bindings. I scanned through the 3400 lines of code and nothing jumped out at me.

John
The following user(s) said Thank You: tcninja

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 19:50 #14694 by andypugh
Replied by andypugh on topic Re:Keyboard re-mapping (key binding)
BigJohnT wrote:

Otherwise you would have to modify axis.py to change the key bindings. I scanned through the 3400 lines of code and nothing jumped out at me.


Is this thing on?
www.linuxcnc.org/component/option,com_ku.../lang,english/#14678

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 21:48 #14701 by BigJohnT
Replied by BigJohnT on topic Re:Keyboard re-mapping (key binding)
Andy's suggestion to use .axisrc is better than my not so well thought out answer. If it exists, the contents of ~/.axisrc are executed as Python source code just before the AXIS gui is displayed. Putting your changes in .axisrc they won't get overwritten at the next upgrade...

John

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 21:54 - 08 Nov 2011 21:55 #14702 by andypugh
Replied by andypugh on topic Re:Keyboard re-mapping (key binding)
And we just found step-by-step instructions:

thread.gmane.org/gmane.linux.distributio...er/12638/focus=12642
Last edit: 08 Nov 2011 21:55 by andypugh.

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 21:55 #14703 by BigJohnT
Replied by BigJohnT on topic Re:Keyboard re-mapping (key binding)
And Andy found this on the mailing list from one of the developers...

AXIS doesn't pay attention to jog keys with modifier keys pressed
because this had some bad interactions with using the numeric keypad as
digits in MDI mode.

You can put magic incantations in the file ~/.axisrc that customize the
jog keys and also get rid of this behavior of ignoring the key if a
modifier key is pressed.

Here is an example which changes the keys that jog the active axis, and
the keys that jog the A axis:

# -- cut here


# Bind ; and ' to jog active axis
root_window.bind("<semicolon>", commands.jog_minus)
root_window.bind("<apostrophe>", commands.jog_plus)
root_window.bind("<KeyRelease-semicolon>", commands.jog_stop)
root_window.bind("<KeyRelease-apostrophe>", commands.jog_stop)

# Bind ( and ) to jog axis 3 (0=X, 1=Y, 2=Z, 3=A, 4=B, ...)
root_window.bind("<parenleft>", lambda e: jog_on(3, -get_jog_speed(3)))
root_window.bind("<parenright>", lambda e: jog_on(3, get_jog_speed(3)))
root_window.bind("<KeyRelease-parenleft>", lambda e: jog_off(3))
root_window.bind("<KeyRelease-parenright>", lambda e: jog_off(3))
# -- cut here

To edit your ~/.axisrc file, open a terminal window (Applications > Accessories >
Terminal). Then type "gedit .axisrc". Paste the lines above into the file,
then click save, then close the application.

The next time you run emc, the settings in the .axisrc file will take effect.

To edit it again, just do the same thing: "gedit .axisrc" in the
terminal.

If you want to use different keys, here's how to figure out what to use instead
of "parenleft" and so on: In the terminal, type "xev". A new window
will pop up. Click on it, but keep an eye on the terminal window. When
you press a key, it will print several lines of information on the
terminal. The one that matters is this one:
state 0x0, keycode 34 (keysym 0x5b, bracketleft), same_screen YES,
^^^^^^^^^^^
that keysym string is the one to put in your .axisrc file.

Jeff

Please Log in or Create an account to join the conversation.

More
08 Nov 2011 22:37 #14705 by ioiotutu
Replied by ioiotutu on topic Re:Keyboard re-mapping (key binding)
It is clear.

I'll try.

Thanks.

Please Log in or Create an account to join the conversation.

More
09 Nov 2011 08:04 #14712 by ioiotutu
Replied by ioiotutu on topic Re:Keyboard re-mapping (key binding)
Thanks,
with this code in axisrc all work fine:

#swap bind key
# Bind ( and ) to jog axis 3 (0=X, 1=Y, 2=Z, 3=A, 4=B, ...)
root_window.bind("<Up>", lambda e: jog_on(0, -get_jog_speed(0)))
root_window.bind("<Down>", lambda e: jog_on(0, +get_jog_speed(0)))
root_window.bind("<KeyRelease-Up>", lambda e: jog_off(0))
root_window.bind("<KeyRelease-Down>", lambda e: jog_off(0))
root_window.bind("<Left>", lambda e: jog_on(1, -get_jog_speed(1)))
root_window.bind("<Right>", lambda e: jog_on(1, +get_jog_speed(1)))
root_window.bind("<KeyRelease-Left>", lambda e: jog_off(1))
root_window.bind("<KeyRelease-Right>", lambda e: jog_off(1))

Please Log in or Create an account to join the conversation.

More
05 Nov 2017 17:35 #101360 by mrchar
Replied by mrchar on topic Re:Keyboard re-mapping (key binding)
Hello, how can I do this when I don't have .axisrc?

I have 2.7.11 linuxcnc

thank you

Please Log in or Create an account to join the conversation.

More
05 Nov 2017 23:37 #101383 by andypugh
Replied by andypugh on topic Re:Keyboard re-mapping (key binding)
You can just create the .axisrc file and it will be used.

Create it with the system text editor (probably Mousepad or Gedit) in your home folder.

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum