Assign keyboard shortcuts to rotation axis

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
desimir
Posts: 3
Joined: Tue Jan 29, 2019 2:22 am

Assign keyboard shortcuts to rotation axis

Post by desimir » Sun Feb 03, 2019 11:18 pm

I am using Clip Studio Paint with Space Pilot Pro, and I customize almost everything I need, but I had no luck assigning any keyboard shortcuts to any rotation axis. I need to assign keys [ and ] to Rz axis (I have also tried other keys), but, I have no luck. I do not have problem assigning mouse wheel actions to axis events, though. This is not something specific to Clip Studio Paint, since eg. Notepad doesn't work either. I have tried to assign Key, Keypress, Macro... using keywords for modifiers, press and hold... all combinations I could imagine and nothing seems to work. Any ideas?

jwick
Moderator
Moderator
Posts: 2681
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Assign keyboard shortcuts to rotation axis

Post by jwick » Mon Feb 04, 2019 1:44 am

The GUI can't help you with this, but if you can edit the cfg file for the app, here is one example of how you add two keys on an axis (positive and negative direction). I think these send A and S keys. You need to replace the <Key> values with the values for the keys you want to send. You can look them up online, but the easiest way is to create a kb macro with our GUI and see what value it saves in the cfg file.

Code: Select all

      <AxisBank Default="true">
        <Name>STR_DEFAULT_BANK</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>200</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>8</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>200</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>14</Key>
            </KeyStroke>
          </Output>
        </Axis>
      </AxisBank>

desimir
Posts: 3
Joined: Tue Jan 29, 2019 2:22 am

Re: Assign keyboard shortcuts to rotation axis

Post by desimir » Tue Feb 05, 2019 5:48 pm

Thank you! Somehow your code work like a magic, even I'm sure that I have tried exactly the same code, which doesn't work in my case! However, your code did the trick! Thank you again!

Meende
Posts: 7
Joined: Wed Apr 10, 2019 8:59 am

Re: Assign keyboard shortcuts to rotation axis

Post by Meende » Mon May 06, 2019 8:31 am

Hello, it really works. Thank U. Maybe you also know how to assign not just a key but a key combination, for example CTRL+ PAGEUP and CTRL + PAGEDOWN?
Thanks a lot

jwick
Moderator
Moderator
Posts: 2681
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Assign keyboard shortcuts to rotation axis

Post by jwick » Tue May 07, 2019 12:32 am

I believe this still works. For example, this adds a Control key Modifier to KeyStroke (PageDown).

Code: Select all

        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <Scale>1.00</Scale>
            <MaxEventRate>40.00</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>4e</Key>
            </KeyStroke>
          </Output>
        </Axis>
Possible Modifiers are: Control, Shift, Alt, Windows, LeftMouse, MiddleMouse, RightMouse.

You can specify more than one.

If you specify conflicting Modifiers on different axes that may be active at the same time, I do my best to deliver what you asked for. That doesn't mean the app will receive it though. Many apps, especially games, poll the keyboard. They will see whatever the state is at the moment it asks. It is best to use a filter to separate the axes in this case.

Meende
Posts: 7
Joined: Wed Apr 10, 2019 8:59 am

Re: Assign keyboard shortcuts to rotation axis

Post by Meende » Sat May 11, 2019 8:24 am

Thanks again, i tried it but did not work for me.
What i am trying to do is to assign CTRL+pageup and CTRL+pagedown to X axis movements in chrome, to switch between tabs.
Thanks

jwick
Moderator
Moderator
Posts: 2681
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Assign keyboard shortcuts to rotation axis

Post by jwick » Wed May 15, 2019 4:42 am

This works for me. Possibly you were not making the changes to the correct file?

I've made some refinements that might help.

1) I find it difficult to push sideways in X. I find it much easier to tilt left/right. I've assigned ctrl+PageUp ctrl+PageDn to that axis (Ry).
2) I've turned off the other axes (<AxisFilter>Dominant and all the other Axes<Enabled>false). The cross talk is very difficult to control with the hand.
3) I've specified a dead region between +/-200. You have to exceed that before anything happens.
4) I've changed the repeat rate to 1/second. It goes way too fast otherwise.

It's not perfect. For one, it may tab in the opposite direction you want. You can change that if you don't like it.
More importantly, sometimes it doesn't release the buttons, so it keeps tabbing. Tap the cap and it will stop. That sure looks like a bug, and sounds familiar.

Code: Select all

    <Device>
      <Name>Standard 3D Mouse</Name>
      <VendorID>0</VendorID>
      <ProductID>0</ProductID>
      <AxisFilter>Dominant</AxisFilter>
      <CurrentAxisBank>Default</CurrentAxisBank>
      <CurrentButtonBank>Default</CurrentButtonBank>
      <AxisBank Default="true">
        <Name>STR_DEFAULT_BANK</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>false</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_X</ActionID>
          </Output>
        </Axis>
        <Axis>
          <Enabled>false</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Y</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Y</ActionID>
          </Output>
        </Axis>
        <Axis>
          <Enabled>false</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Z</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Z</ActionID>
          </Output>
        </Axis>
        <Axis>
          <Enabled>false</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rx</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Rx</ActionID>
          </Output>
        </Axis>
	<Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>-512</Min>
            <Max>-200</Max>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <Scale>1.00</Scale>
            <MaxEventRate>1.00</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>4e</Key>
            </KeyStroke>
          </Output>
        </Axis>
	<Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>-199</Min>
            <Max>199</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Ry</ActionID>
          </Output>
        </Axis>
	<Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>200</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <Scale>1.00</Scale>
            <MaxEventRate>1.00</MaxEventRate>
            <Modifiers>
              <Modifier>Control</Modifier>
            </Modifiers>
            <KeyStroke>
              <Key>4b</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>false</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Rz</ActionID>
          </Output>
        </Axis>
      </AxisBank>
      ...

willkang
Posts: 1
Joined: Tue Feb 25, 2020 4:10 pm

Re: Assign keyboard shortcuts to rotation axis

Post by willkang » Tue Feb 25, 2020 4:16 pm

Hi, I'm trying to Assign keyboard shortcuts to rotation axis, too,

Would you help me with more details as in which file to modify? and where the file is located(file path)?
and if the Software I'm trying to program the Axis is not in supported software list, what would be the steps to follow to create a new cfg file?

Thank you!
WILL

jwick
Moderator
Moderator
Posts: 2681
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Assign keyboard shortcuts to rotation axis

Post by jwick » Wed Feb 26, 2020 1:44 am

Hello WILL,

Each application needs a cfg (XML) file that describes what the driver should do when the application is in focus.
If we don't ship a cfg for an app, the driver will use a default one. If you make changes in our GUI while your app is in focus, a file specific to your application will be written. You can then modify that cfg.

The steps would be:
1) Start our driver
2) Start our GUI (3DxSmartUI)
3) Start your app. Make sure it has focus.
4) In our GUI make some change for your app. E.g., turn off and on all the axes in the Advanced panel.
You now have a cfg for your application in %appdata%\3Dconnexion\3DxWare\Cfg (yourapplicationname.xml).
It has entries for the axes on your device which you can now edit.

The next step is to figure out what you want those axes to do. That is, how to cause panning/zooming/rotation in the application. Since the application does not have 3D mouse support, you have to trigger these actions some other way. Some applications support a joystick. Most support the 2D mouse in some way. Some work with keyboard keys (arrow keys, ASDW, etc). The app is unlikely to ever be as smooth as if it had proper 3D mouse support. Only the app developer can add that, or potentially a plugin can be written by someone else.

Once you have decided which to use, you can follow the template above for telling the driver what to do.
And, of course, asking here for more detailed help.

For kb shortcuts, the syntax is not meant for human consumption. Let the GUI write the XML for you by assigning the keyboard shortcut to a device button. That gives you the correct syntax (<Key>xx</Key>) for use on an axis. The xx is hex for the HID code of the key. It is specific to a kb locale.

Post Reply