Map Key Press Inputs to SpaceMouse Outputs

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
hzw
Posts: 2
Joined: Fri Nov 17, 2023 1:50 am

Map Key Press Inputs to SpaceMouse Outputs

Post by hzw »

Dear all,

I'm using a SpaceMouse to control the stage of a microscope in the software that the vendor provides. With the SpaceMouse that works in a pretty neat and fast way. I would like to map/emulate that behavior with a keyboard, e.g., by accepting a right arrow press as a positive x axis move with the Space Mouse. (This is different from the typical question where you want to map your SpaceMouse inputs to Keyboard outputs.)

What would be the best way to achieve this behavior?

The current XML file for the tool is the following:

Code: Select all

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<AppCfg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Default="false" CfgFormatVersion="1.3" ThisFileVersion="1.13">
  <AppInfo>
    <Signature>
      <Name>TomoStudio</Name>
      <ExecutableName>TomoStudio.exe</ExecutableName>
    </Signature>
    <Options />
  </AppInfo>
  <CfgProperties>
    <ID>ID_TomoStudio</ID>
    <Name>TomoStudio</Name>
    <InheritsFromID>ID_Default_KMJ_Cfg</InheritsFromID>
  </CfgProperties>
  <AuthorInfo>
    <DriverVersion>17.8.16.20445</DriverVersion>
    <LastChange>
      <Tool>3DxSmartUI.exe</Tool>
      <Version>1.2.23265.20445</Version>
      <Date>11/23/2023 5:15:57 PM UTC</Date>
      <User>DF747110-FF2A-48B1-8D85-7AE2FD825A4C</User>
    </LastChange>
  </AuthorInfo>
  <Devices>
    <Device>
      <ID>ID_Standard_3D_Mouse</ID>
      <AxisFilter>Dominant</AxisFilter>
      <AxisBank>
        <Name>Default</Name>
        <ID>Default</ID>
        <Axis>
          <Enabled>true</Enabled>
          <Input>
            <ActionID>HIDMultiAxis_X</ActionID>
            <Min>-512</Min>
            <Max>511</Max>
          </Input>
          <Output>
            <ActionID>HIDMultiAxis_X</ActionID>
          </Output>
        </Axis>
        <Axis>
          <Enabled>true</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>HIDMouse_Wheel</ActionID>
          </Output>
        </Axis>
      </AxisBank>
    </Device>
  </Devices>
</AppCfg>
My intuition would be to replace every axis block with something along the lines of

Code: Select all

        
<Axis>
  <Enabled>true</Enabled>
  <Input>
    <ActionID>KB_Keystroke</ActionID>
    <RepeatStyle>PressAndHold</RepeatStyle>
    <KeyStroke>
      <Key>4F</Key>
    </KeyStroke>
  </Input>
  <Output>
    <ActionID>HIDMultiAxis_X</ActionID>
  </Output>
</Axis>,
where 4F is the right arrow (HID usages are listed here: https://usb.org/sites/default/files/hut1_4.pdf in chapter 10.).

However, I have not yet been able to make this work. The main questions that I couldn't answer are the following:
  • How do I achieve the mapping of one key press to a single value of the SpaceMouse? (If I need to at all)
  • What would be the correct syntax for that?
  • How do I separate between key presses and press-and-holds?
I appreciate any help you can give me in this regard. Thanks a lot in advance!

Best wishes
Henning
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Map Key Press Inputs to SpaceMouse Outputs

Post by jwick »

That's a clever idea. But not something we support.
hzw
Posts: 2
Joined: Fri Nov 17, 2023 1:50 am

Re: Map Key Press Inputs to SpaceMouse Outputs

Post by hzw »

Hi johnwick,

Thanks for the quick reply and for the compliments.
Would be a much more clever idea if it was working.

Just to understand: Is that endeavor fundamentally impossible (using the xml files or the SDK), or is it possible in theory and you just don't want to support it?
My use case is a remotely controlled computer. I.e., there is a SpaceMouse connected to the remote computer with the microscope, but sometimes I would like to control it from another computer that is not on site. Would be a pity if there is no way to make this work.

Best wishes
Henning
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Map Key Press Inputs to SpaceMouse Outputs

Post by jwick »

Nothing's impossible. It's software.

But you probably can also run the SpaceMouse remotely.
Post Reply