Space mouse. Assigning X/Y axis to keyborad arrows

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

kenny113
Posts: 4
Joined: Thu Sep 16, 2021 5:06 pm

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by kenny113 »

ngomes wrote: Fri Nov 04, 2022 11:49 am
kenny113 wrote: Fri Nov 04, 2022 10:56 am I can’t PM you for some reason,
You can't use private messages until you reach a number of approved posts.

Please try again as it should now work for you.
PM sent. Thanks!
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by jwick »

kenny113,

package sent by email
augren
Posts: 1
Joined: Thu Dec 08, 2022 4:00 am

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by augren »

Hello, I am trying to use it with pathology WSI too. could anyone send me cfg?
somevetpathologist
Posts: 4
Joined: Fri Mar 31, 2023 7:44 am

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by somevetpathologist »

Dear all, particularly dear JWick,
I did manage to assign zoom to the twisty action, but I cannot manage to make assigning keyboard arrows to an axis work, no matter how much metaphorical incense i burn at the holy altar of Lap-Top.

Background: i am trying to do the exact same thing, i.e. try out a Space mouse for easy, all-day, wrist friendly navigation through dipgitalized histologic slides -> i need it to pan (on the X and Y, and/or Rx and Ry axis) and to zoom (on the twisty axis).

Coud you, by chance look at the xml i tried, and tell me at which point i am being stupid?:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!--
(c) Copyright 3Dconnexion. All rights reserved. 
$Revision: 17343 $
-->
<AppCfg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Default="false" CfgFormatVersion="1.3" ThisFileVersion="1.12">
  <AppInfo> 
    <Signature>
      <Name>Microsoft Edge</Name>
      <ExecutableName>msedge.exe</ExecutableName>
    </Signature>
    <Options />
  </AppInfo>
  <CfgProperties>
    <ID>ID_Microsoft Edge</ID>
    <Name>Microsoft Edge</Name>
    <InheritsFromID>ID_Default_KMJ_Cfg</InheritsFromID>
  </CfgProperties>
  <Devices>
    <Device>
      <ID>ID_Standard_3D_Mouse</ID>
      <AxisBank>
        <Name>Default</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>4F</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>50</Key>
            </KeyStroke>
          </Output>
		</Axis>
		<Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Y</ActionID>
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>51</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Y</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>100</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>52</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Z</ActionID>
            <Min>0</Min>
            <Max>511</Max>
            <Deadband>200</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>4E</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Z</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
            <Deadband>200</Deadband>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>4B</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rz</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMouse_Wheel</ActionID>
            <Reversed>true</Reversed>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rx</ActionID>
            <Min>0</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>4F</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Rx</ActionID>
            <Min>-512</Min>
            <Max>0</Max>
          </Input>
          <Output>
            <ActionID>KB_Keystroke</ActionID>
            <RepeatStyle>PressAndHold</RepeatStyle>
            <KeyStroke>
              <Key>50</Key>
            </KeyStroke>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_Ry</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_Ry</ActionID>
          </Output>
        </Axis>
      </AxisBank>
    </Device>
  </Devices>
  <AuthorInfo>
    <DriverVersion>17.7.2.18242</DriverVersion>
    <LastChange>
      <Tool>3DxSmartUI.exe</Tool>
      <Version>1.2.21076.18233</Version>
      <Date>3/31/2023 6:06:09 PM UTC</Date>
      <User>removed by moderator</User>
    </LastChange>
  </AuthorInfo>
  <Settings>
    <OverallScale>5.00</OverallScale>
  </Settings>
</AppCfg>
somevetpathologist
Posts: 4
Joined: Fri Mar 31, 2023 7:44 am

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by somevetpathologist »

additional information: In fact i think i did manage to assign the right arrrow the first time i tried... but then i spend about a day searching for the codes for the left, up and down arrow, because i was mistakenly searching through old scancode tables instead of the USB tables and had been to stupid to find the keyboard template that already comes with the Software
... and once i had figured out the codes, i now seem to be completely unable to get any arrows mapped to anything:)
somevetpathologist
Posts: 4
Joined: Fri Mar 31, 2023 7:44 am

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by somevetpathologist »

For any other non-programmers who want to map keyboard keys to axis in the Spacemouse:
  • First, you have to open the software you are intending to use for slide-viewing (eg. QuPath, your browser, Visioharm, ImageScope..), and while the window is active, open the Space mouse settings thingy. Then change something random in there, ideally e.g. activate all the axes you want to use -> it will create a new xml file in your %AppData%\Roaming folder, i think in a subfolder \3Dconnexion\cfg (sry, away from the computer with the Spacemouse right now, so typing from memory). The file name will roughtly constitute the name of the software.
  • You then open that file with any text editor (windows notepad, notepad++, visual studio code...).
  • You either understand the xml becaue you are already smart. Or, you go check out a template that already does it, you can find one on your PC in the Installation folder of 3dconnexion, i.e. probably something like C:\Program Files\3dconnexion, depending where you put it. it is called keyboardtemplate.
  • You change whatever you want in the xml file you created in the first place. You then safe the thing-> It should work. [which, in my case, it did for some changes, and not for others -> i assume i am making some synthax error or something)
    Note: if there is some major synthax errors, it seems to put the xml file in a new subfolder called bak ... in that case not to worry, you can just keep on correcting and safe the file in the correct parent folder again. You cannot break anything it seems, if anything goes wrong just delete all the files in the app data\roaming\...\cfg folder, open the settings again in the software you are using, and voila, a new xml should have popped up.


... anywhay, no clue if the space mouse is even a good navigation device for digital pathology, me personally i assume a good keyboard and mouse may be just as good or better, that is what i am using so far. But i wanted to try because one of my colleagues is getting writst strains from all the mousing and keyboarding... I would be happy to hear any experience from the community, including better ways to use the Spacemouse than mapping it so it can be used for arrow-key-panning and zoom.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Space mouse. Assigning X/Y axis to keyborad arrows

Post by jwick »

somevetpathologist,

I don't see anything fundamentally wrong with what you have.
I pasted it into my %APPPDATA%/.../Cfg/MSEdge.xml file and it worked.
I did change:
<AxisBank Default="true">
But that should not matter.

You can see what keys are being sent by turning on logging (3Dx systray icon ->Write Log File). Then you can baretail %localappdata%\3Dconnexion\3DxWare\3DxService.log

Web pages are funny things though. The response is not very consistent.
Do you have a web page with an image I can test this on?

I have an extension I did for some other pathologists that were using chrome. I can try that to see if it works for these web pages.
If it works well on the web pages you typically use, I can send it to you to try.
It has more fine-grained movement than the arrow keys because it uses the mouse interface (LMB+MouseX/Y is often used for panning).

The easiest way to find the Key value to use for an axis is, as you mentioned above, make a cfg by doing something in our GUI while the app is in focus, THEN, make a kb macro for a button for that key. You won't need that macro, but it will write the correct Usage code value for your keyboard in the %appdata% cfg file. The values vary somewhat per keyboard layout.
Post Reply