Spaceball buttons customization

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
Thomot512
Posts: 4
Joined: Fri Nov 13, 2020 9:11 pm

Spaceball buttons customization

Post by Thomot512 »

Hi everyone,

I have been trying to configure my spaceball correctly and I have stumble into a small issue. I would like to assign one button to do the same as the CTRL key of the keyboard.
Right now my user.cfg looks like this:

Code: Select all

<FCParamGroup Name="Spaceball">
        <FCParamGroup Name="Motion">
          <FCBool Name="FlipYZ" Value="1"/>
          <FCBool Name="Dominant" Value="0"/>
        </FCParamGroup>
        <FCParamGroup Name="Buttons">
          <FCParamGroup Name="0">
            <FCText Name="Command"/>
            <FCText Name="Description">Menu</FCText>
          </FCParamGroup>
          <FCParamGroup Name="1">
            <FCText Name="Command">Std_ViewFitAll</FCText>
            <FCText Name="Description">Fit</FCText>
          </FCParamGroup>
          <FCParamGroup Name="2">
            <FCText Name="Command">Std_ViewTop</FCText>
            <FCText Name="Description">Top</FCText>
          </FCParamGroup>
          <FCParamGroup Name="3">
            <FCText Name="Command"/>
            <FCText Name="Description">4</FCText>
          </FCParamGroup>
          <FCParamGroup Name="4">
            <FCText Name="Command">Std_ViewRight</FCText>
            <FCText Name="Description">Right</FCText>
          </FCParamGroup>
          <FCParamGroup Name="5">
            <FCText Name="Command">Std_ViewFront</FCText>
            <FCText Name="Description">Front</FCText>
          </FCParamGroup>
          <FCParamGroup Name="6">
            <FCText Name="Command"/>
            <FCText Name="Description">7</FCText>
          </FCParamGroup>
          <FCParamGroup Name="7">
            <FCText Name="Command"/>
            <FCText Name="Description">8</FCText>
          </FCParamGroup>
          <FCParamGroup Name="8">
            <FCText Name="Command">Std_ViewRotateRight</FCText>
            <FCText Name="Description">Clockwise</FCText>
          </FCParamGroup>
          <FCParamGroup Name="9">
            <FCText Name="Command"/>
            <FCText Name="Description">10</FCText>
          </FCParamGroup>
          <FCParamGroup Name="10">
            <FCText Name="Command"/>
            <FCText Name="Description">11</FCText>
          </FCParamGroup>
          <FCParamGroup Name="11">
            <FCText Name="Command"/>
            <FCText Name="Description">12</FCText>
          </FCParamGroup>
          <FCParamGroup Name="12">
            <FCText Name="Command"/>
            <FCText Name="Description">1</FCText>
          </FCParamGroup>
          <FCParamGroup Name="13">
            <FCText Name="Command"/>
            <FCText Name="Description">2</FCText>
          </FCParamGroup>
          <FCParamGroup Name="14">
            <FCText Name="Command"/>
            <FCText Name="Description">3</FCText>
          </FCParamGroup>
          <FCParamGroup Name="15">
            <FCText Name="Command"/>
            <FCText Name="Description">4</FCText>
          </FCParamGroup>
          <FCParamGroup Name="16">
            <FCText Name="Command"/>
            <FCText Name="Description">17</FCText>
          </FCParamGroup>
          <FCParamGroup Name="17">
            <FCText Name="Command"/>
            <FCText Name="Description">18</FCText>
          </FCParamGroup>
          <FCParamGroup Name="18">
            <FCText Name="Command"/>
            <FCText Name="Description">19</FCText>
          </FCParamGroup>
          <FCParamGroup Name="19">
            <FCText Name="Command"/>
            <FCText Name="Description">20</FCText>
          </FCParamGroup>
          <FCParamGroup Name="20">
            <FCText Name="Command"/>
            <FCText Name="Description">21</FCText>
          </FCParamGroup>
          <FCParamGroup Name="21">
            <FCText Name="Command"/>
            <FCText Name="Description">22</FCText>
          </FCParamGroup>
          <FCParamGroup Name="22">
            <FCText Name="Command"/>
            <FCText Name="Description">esc</FCText>
          </FCParamGroup>
          <FCParamGroup Name="23">
            <FCText Name="Command"/>
            <FCText Name="Description">alt</FCText>
          </FCParamGroup>
          <FCParamGroup Name="24">
            <FCText Name="Command"/>
            <FCText Name="Description">shift</FCText>
          </FCParamGroup>
          <FCParamGroup Name="25">
            <FCText Name="Command"/>
            <FCText Name="Description">ctrl</FCText>
          </FCParamGroup>
          <FCParamGroup Name="26">
            <FCText Name="Command"/>
            <FCText Name="Description">lock</FCText>
          </FCParamGroup>
I tried a few things such as:

Code: Select all

	 <FCParamGroup Name="25">
            <FCText Name="Command">ctrl</FCText>
            <FCText Name="Description">ctrl</FCText>
          </FCParamGroup>

Code: Select all

	 <FCParamGroup Name="25">
            <FCText Name="Command">Ctrl</FCText>
            <FCText Name="Description">ctrl</FCText>
          </FCParamGroup>

Code: Select all

	 <FCParamGroup Name="25">
            <FCText Name="Command">CTRL</FCText>
            <FCText Name="Description">ctrl</FCText>
          </FCParamGroup>

Code: Select all

	 <FCParamGroup Name="25">
            <FCText Name="Command">Std_Ctrl</FCText>
            <FCText Name="Description">ctrl</FCText>
          </FCParamGroup>
None of which worked. Is it possible to assign the spaceball buttons to a keyboard key? If yes, what am I doing wrong?
I have FreeCad 0.19, and I'm on Linux.
Dougl
Posts: 48
Joined: Thu Oct 01, 2020 6:08 pm

Re: Spaceball buttons customization

Post by Dougl »

Have you used the configuration under Tools -> Customize? I don't see anything about keyboard shortcuts though. But those settings must be saved somewhere. Was going to say to set something which is a ctr-key feature and look at what's set but my guess is they call directly into FC instead of using shortcuts. You probably have a half dozen or more buttons so I can see how having one for Ctrl keyboard would be handy.

I just have the spacenav puck with 2 buttons and that's where I defined by 2 buttons and other settings.
Doug
FreeCAD for Linux
Thomot512
Posts: 4
Joined: Fri Nov 13, 2020 9:11 pm

Re: Spaceball buttons customization

Post by Thomot512 »

Yes I tried setting it through the Tools-Customize but I could not figure out how to set a key, that is when I started to go see the config files.
I tried to create a custom keyboard shortcut to see how it look like in the config file.
But I was unable to find the solution with what I saw.
Dougl
Posts: 48
Joined: Thu Oct 01, 2020 6:08 pm

Re: Spaceball buttons customization

Post by Dougl »

@Thomot512 I have built the source for spacenavd from a few years back and from the many FreeCAD forum posts I found on this specific question(ie mapping spacenav keys to keyboard events ) it looks like it's really something to be done in the driver. So I will find the latest source, see if I can still build it and look for possible ways to set that up.
Doug
FreeCAD for Linux
Dougl
Posts: 48
Joined: Thu Oct 01, 2020 6:08 pm

Re: Spaceball buttons customization

Post by Dougl »

Have you tried the driver configuration file in /etc/spnavrc using kbmap0 = Control_L ?

https://github.com/FreeSpacenav/spacena ... pnavrc#L78

https://github.com/FreeSpacenav/spacena ... le-spnavrc

I have a SpaceNavigator( 2 button ) and I could not get the Control_L nor Escape mappings to work with FreeCAD.
This person says they got it to work in Blender.... I have blender appimage so maybe I will try that next and if it works then it's something going on in translation with FreeCAD. Otherwise I just don't know.
https://sourceforge.net/p/spacenav/mail ... /29228099/

UPDATE: I've come to realize things don't work as expected when starting the spacenavd daemon from systemctl vs systemd and that includes keymapping. By creating a dummy /etc/inittab file the setup_init installation script will work and creates the /etc/init.d/spacenavd script.
When you run that "sudo /etc/init.d/spacenavd start" it will read and enable both Escape and Control_L button mappings. I have verified this works in Blender. In FreeCAD, I can only see the Escape key working. Control_L does not seem to work. ie I can't do button1+S to save in FreeCAD.

Why spacenavd works so differently when started from systemd vs systemctl I have not figured out yet. But, I did figure out that by copying my ~/.Xauthority file to /root then the Escape and Control_L button mapping works with either systemctl(requires -d -v) or systemd(works with just -v).
But again, Blender handles both Escape and Control_L while FreeCAD only handles the Escape button event.
Doug
FreeCAD for Linux
Dougl
Posts: 48
Joined: Thu Oct 01, 2020 6:08 pm

Re: Spaceball buttons customization

Post by Dougl »

I've been in comms with a developer on spacenavd and he has confirmed the modifiers work fine with Blender but many do not work with FreeCAD although some do work like the Escape one. He might look into doing something with xtest to see if FreeCAD will pick up those messages.

So this might run deeper into how FreeCAD handles keyboard messages and not currently working with certain modifier keys. Yet.
Doug
FreeCAD for Linux
Thomot512
Posts: 4
Joined: Fri Nov 13, 2020 9:11 pm

Re: Spaceball buttons customization

Post by Thomot512 »

Thanks a lot for looking into this issue. I hope a solution can be found without too much hassle.
Thomot512
Posts: 4
Joined: Fri Nov 13, 2020 9:11 pm

Re: Spaceball buttons customization

Post by Thomot512 »

Hi, is there any news about this issue?
I'm now using FreeCAD 0.20, and I still did not manage to get the shift, control, alt, and escape button to work as intended.
Dougl
Posts: 48
Joined: Thu Oct 01, 2020 6:08 pm

Re: Spaceball buttons customization

Post by Dougl »

Thomot512 wrote: Fri May 27, 2022 11:34 am Hi, is there any news about this issue?
I'm now using FreeCAD 0.20, and I still did not manage to get the shift, control, alt, and escape button to work as intended.
Have you also tried updating your spacenavd? I see development as late as just 2 months ago so maybe there's been updates.
https://github.com/FreeSpacenav/spacenavd
Doug
FreeCAD for Linux
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Spaceball buttons customization

Post by M4x »

This thread is related and contains a working spacenavd config for CTRL: https://forum.freecadweb.org/viewtopic.php?t=49542

My upgrade from the small SpaceMouse to a SpaceMouse Pro is on it's way. Therefore I'll be able to have a closer look myself soon.
Post Reply