Greatest possible value

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

Moderator: Moderators

Post Reply
BARDACK
Posts: 4
Joined: Tue May 12, 2009 3:47 am
Location: Russia
Contact:

Greatest possible value

Post by BARDACK »

Hi.

SpacePilot & my own APP (non ATL)

How to receive the greatest possible value for parametre

SiSpwEvent.u.spwData.mData[...]

for SI_MOTION_EVENT type of event?

Need help

P.S. Sorry for my English
jwick
Moderator
Moderator
Posts: 3348
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hello Bardack,

The maximum value that you can get from a device axis is determined by the config file used by your application. The device will only generate up to about 500, but the user can scale this value using the GUI. It can become any long, but is generally clipped to +/- 2000 in the config files that we ship.

If your software has issues with large numbers, it should clip the data at the maximum value it can handle.

Jim
3Dx Software Development
BARDACK
Posts: 4
Joined: Tue May 12, 2009 3:47 am
Location: Russia
Contact:

Post by BARDACK »

Thx Jim, i know it.

I should know absolute position of each sensor.
I can use for this purpose this functions:

SiSyncGetScaleOverall
SiSyncGetScaleTx
SiSyncGetScaleTy
SiSyncGetScaleTz
SiSyncGetScaleRx
SiSyncGetScaleRy
SiSyncGetScaleRz

?
jwick
Moderator
Moderator
Posts: 3348
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Yes, you can use those functions to get most of the transformations that are being applied to the data. The Set functions allow you to set these scale factors to 1.0.

There can also be some small amount of scaling that is applied as a result of how slow or fast your application runs. If you want completely raw data, the best API to use is HID.

Jim
3Dx Software Development
BARDACK
Posts: 4
Joined: Tue May 12, 2009 3:47 am
Location: Russia
Contact:

Post by BARDACK »

For some reason all these functions return value 21 - "Wrong hash code sent to a Sync function". But all the rest works.

My code:

Code: Select all


//Initialisation
SiHdl HID3DCHandle;
SiOpenData oData; 

SiOpenWinInit (&oData, this->Handle);
SiSetUiMode(HID3DCHandle, SI_UI_ALL_CONTROLS);

HID3DCHandle = SiOpen("Project1", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData);
if (HID3DCHandle == NULL)
{
   SiTerminate();
}


//AppMessageHandler
SiSpwEvent     Event;         
SiGetEventData EventData;

SiGetEventWinInit(&EventData, Msg.message, Msg.wParam, Msg.lParam);

if (SiGetEvent(HID3DCHandle, 0, &EventData, &Event) == SI_IS_EVENT)
{
   if (Event.type == SI_MOTION_EVENT)
   {
      SPWfloat32 ScaleOvr;
      SPWfloat32 ScaleTy;
      SPWfloat32 ScaleRz;
      SPWfloat32 ScaleTz;

      SpwRetVal Result = SiSyncGetScaleOverall(HID3DCHandle, &ScaleOvr);
      //Here Result value is 21 and not write ScaleOvr variable
      //And so on... 

      //... 
   }
}
Where I am mistaken?
jwick
Moderator
Moderator
Posts: 3348
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Before you can call an SiSync function you have to respond to a Sync Query event. The driver sends you one of these when it finds APP_CONTROLS_BUTTONS = TRUE in the config file for your application. It won't try to sync with you or respond to syncing calls if your config file is not setup for synching (defines the variable). Take a look at the solidworks config file.
Post Reply