SpaceMouse Command Action Ordering

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

Moderator: Moderators

Post Reply
gmartin314
Posts: 1
Joined: Thu May 28, 2026 5:01 am

SpaceMouse Command Action Ordering

Post by gmartin314 »

Hello, I am writing code to integrate SpaceMouse in a web application. I am using the 3dconnexionJS SDK, v4-0-6_r22071.

In the code, I've added command actions, and I have seen the actions in the 3dconnexion config UI. However, the ordering of the actions is not what I was expecting.

Here is the JavaScript code I am using:

Code: Select all

const actionTree = new TDx._3Dconnexion.ActionTree();
actionSet = actionTree.push(new TDx._3Dconnexion.ActionSet('Default', 'My Actions'));

cat1 = actionSet.push(new TDx._3Dconnexion.Category('CAT_ID_A', 'CAT A'));
cat2 = actionSet.push(new TDx._3Dconnexion.Category('CAT_ID_B', 'CAT B'));
cat3 = actionSet.push(new TDx._3Dconnexion.Category('CAT_ID_C', 'CAT C'));
cat4 = actionSet.push(new TDx._3Dconnexion.Category('CAT_ID_D', 'CAT D'));

cat1.push(new TDx._3Dconnexion.Action('ACT_ID_A_1', 'Action A-1', 'Some Action'));
cat1.push(new TDx._3Dconnexion.Action('ACT_ID_A_2', 'Action A-2', 'Some Action2'));
cat1.push(new TDx._3Dconnexion.Action('ACT_ID_A_3', 'Action A-3', 'Some Action3'));

cat2.push(new TDx._3Dconnexion.Action('ACT_ID_B_1', 'Action B-1', 'Some Action'));
cat2.push(new TDx._3Dconnexion.Action('ACT_ID_B_2', 'Action B-2', 'Some Action2'));
cat2.push(new TDx._3Dconnexion.Action('ACT_ID_B_3', 'Action B-3', 'Some Action3'));

cat3.push(new TDx._3Dconnexion.Action('ACT_ID_C_1', 'Action C-1', 'Some Action'));
cat3.push(new TDx._3Dconnexion.Action('ACT_ID_C_2', 'Action C-2', 'Some Action2'));
cat3.push(new TDx._3Dconnexion.Action('ACT_ID_C_3', 'Action C-3', 'Some Action3'));

cat4.push(new TDx._3Dconnexion.Action('ACT_ID_D_1', 'Action D-1', 'Some Action'));
cat4.push(new TDx._3Dconnexion.Action('ACT_ID_D_2', 'Action D-2', 'Some Action2'));
cat4.push(new TDx._3Dconnexion.Action('ACT_ID_D_3', 'Action D-3', 'Some Action3'));

this.#spaceMouseConnection.update3dcontroller({
  commands: { activeSet: 'Default', tree: actionTree },
});
Given the order in which I called the push method, I would have expected the actions to be ordered in ABC order,
But that is not the case. In the Exported Commands in the config UI, the ordering looks almost random:

Code: Select all

CAT C
  Action C-3
  Action C-2
  Action C-1
CAT B
  Action B-1
  Action B-3
  Action B-2
CAT A
  Action A-3
  Action A-2
  Action A-1
CAT D
  Action D-2
  Action D-1
  Action D-3
Am I doing something incorrectly in defining the action tree? Any suggestions?

Any assistance would be greatly appreciated.
Post Reply