Space Mouse Enterprise Buttons

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

Moderator: Moderators

Post Reply
hjbflyer
Posts: 9
Joined: Tue Feb 28, 2017 9:47 am

Space Mouse Enterprise Buttons

Post by hjbflyer » Tue Mar 07, 2017 11:00 am

I am using the SME on OS X with driver 10.4.3.

First question: I have enabled button events with "SetConnexionClientMask(MASK_ALL)". MASK_ALL = 0x3FFF. But I am not receiving events for all buttons. I do get events for 1-10 and no events for 11-12.
I do get also events on some other buttons, but not from all. What could be the reason?

Second question: Is there some documentation about the button numbering?

Thanks

UtaSH
Moderator
Moderator
Posts: 3208
Joined: Mon Nov 27, 2006 10:34 am
Location: Munich, Germany
Contact:

Re: Space Mouse Enterprise Buttons

Post by UtaSH » Tue Mar 14, 2017 10:11 am

Moving to Developer's Forum.

crobl
Moderator
Moderator
Posts: 131
Joined: Mon Feb 26, 2007 8:34 am
Location: Freiham, Germany

Re: Space Mouse Enterprise Buttons

Post by crobl » Mon Mar 27, 2017 3:03 am

Hi hjbflyer,

you're almost correct:
It's not SetConnexionClientMask() - just call SetConnexionClientButtonMask(clientID, kConnexionMaskAllButtons);

This will do the job!

The button numbers can be calculated from the mask buttons, there is no "1" (label on the device) -> "whatever value received" table.
(well, there is - it is in the driver and you should actually use the driver to configure (map) the buttons.)
Ideally you'll use the "Application Commands" for this purpose, but we currently do not officially (SDK) support it and usually only give these information to bigger companies, that want to have their application added to the driver.

What application do you develop? Can you give some details on it?

regarding the buttons, you can use a code like the following to calculate a number rater than using the mask given in the buttons field via ConnexionDeviceState.

Code: Select all

int getButton(NSUInteger buttonMask)
{
  int button = 0;

  for (int i = 0; i < 32; i++)
  {
    if (buttonMask & (1 << i))
      button += i;
  }
  return button + 1;
}

Regards,

Christian

hjbflyer
Posts: 9
Joined: Tue Feb 28, 2017 9:47 am

Re: Space Mouse Enterprise Buttons

Post by hjbflyer » Fri Mar 31, 2017 6:37 am

Actually I am not developing an application. I am a user. I do use Sketchup and SweetHome3D for drawing floor plans. Sketchup is nice, especially because of the support of the 3D mouse. But for drawing floor plans I prefer SweetHome3D.
Unfortunately there is not support for the 3D mouse. What I have done is, I have created objects like "windows" using Sketchup and later I have imported these objects into SweetHome3D. You can drop the windows on a wall and they position automatically. SweetHomeD is showing a 2D and 3D window in parallel. While you are drawing the floor plan, the 3d view is showing that walls and windows. For using the mouse in the 3D view, you have to leave the 2D view. More information
on SweetHome3d can be found http://www.sweethome3d.com.

I thought it would be nice to use the 3D mouse in that 3D window. Because my main profession is software developer and because SweetHome3D is an Open Source Java project, I had the idea to add the support myself. So I made
  • Step 1: Implement a Java API.This has been finished and can be used an downloaded from https://github.com/hjbflyer/3DConnexionAPI. Even if has been tested on OS X only, it should work on Linux and Windows as well. (Maybe the makefile has to be updated to create the native libraries - and of course it uses the Mac version of the API).
.
  • Step 2: Use an example application as proof of concept. Next I wanted to have a simple example. I decided to use the JavaFX LegoDemo created by Tom Schindl. Java FX comes with a Viewer3D which could be used to display 3d objects. Unfortunately the code need to access the camera position, rotation, ... were not accessible from the outside. I have contacted the JavaFX runtime developers and explained my problem. In less than a day they changed the API of the Viewer3D and let
    me access the camera position. :D ( Thank to Tom Schindl)
    Now it was easy to create the test app. See the snippet below

    Code: Select all

          ...
          long signature = ConnexionAPI.pack4chars('H','J','B','1');
          ConnexionAPI api = new ConnexionAPI(signature, "java", ConnexionAPI.USE_SEPARATE_THREAD);
          api.addAxisChangedListener(this);
          ...
          
         @Override
         public void axisChanged(int[] values) {
             viewer3d.setCameraPositionX(viewer3d.getCameraPositionX() - values[0]/100);
             viewer3d.setCameraPositionX(viewer3d.getCameraPositionX() - values[1]/100);
             viewer3d.contentScaleBy(values[2]/-100);
             ...
        }
    
    I have created a YouTube video to show how it is working.https://www.youtube.com/watch?v=G1AKCiszT_w
  • Step 3: Add or let someone add that API to SweetHome3D. SweetHome3D is a large project, and I had not time yet to look into the code deeply. I have created a "feature request" on their web page. Unfortunately there was no answer yet. They claim that they have 10000 downloads a day. So it looks that there is the chance of selling many 3D mice if they would have support for it. May be 3DConnexion should try to contact them directly.

Post Reply