The spacedevice module allows applications to support 3D input devices such as a SpaceMouse or a SpaceBall. The module wraps the 3DxWare SDK by 3Dconnexion. For a more detailed description of the SDK see the documentation that is part of the SDK.
The module has to be used in conjunction with a GUI toolkit as there must be a window that receives the 3D input device events. In principle, any GUI toolkit can be used as long as it allows obtaining the native windows handle and accessing system events. The steps necessary to use a 3D input device are as follows:
| ) |
True if the module functionality is available. Currently,
this function will only return True under Windows and if the
functionality was enabled during compilation.
If this function returns False, an exception will be raised
whenever you try to instantiate a class from this module.
| ) |
| appname, hwnd, devID=SI_ANY_DEVICE) |
This method calls the SDK functions SiOpenWinInit() and SiOpen().
| ) |
This method calls the SDK function SiClose().
| msgid, wparam, lparam) |
RetVal is an object of type
RetVal that represents an enumeration. It is
RetVal.IS_EVENT if the event was generated by a 3D input device,
otherwise it is RetVal.NOT_EVENT.
EventType is an object of type EventType that again represents
an enumeration. It can take one of the following values:
EventType.BUTTON_EVENT
EventType.MOTION_EVENT
EventType.ZERO_EVENT
EventType.EXCEPTION_EVENT
The contents of the third value, Data, depend on the event type:
| Event type | Data |
|---|---|
BUTTON_EVENT |
(pressed, released) |
MOTION_EVENT |
(translation, rotation, period) |
ZERO_EVENT |
None |
EXCEPTION_EVENT |
None |
pressed and released are each lists that contain the numbers of the button that were either pressed or released. translation is a 3-tuple containing the translation vector and rotation is a 3-tuple containing the rotation vector. period contains the time in milliseconds since the last device event.
This method calls the SDK functions SiGetEventWinInit() and SiGetEvent().
| s) |
This method calls the SDK function SiBeep().
| ) |
This method calls the SDK function SiGetDeviceID().
| ) |
This method calls the SDK function SiGetDeviceInfo().
| ) |
This method calls the SDK function SiGetDriverInfo().
| ) |
This method calls the SDK function SiGetNumDevices().
| ) |
This method calls the SDK function SiRezero().
| show) |
This method calls the function SiSetUiMode().
(C) 1998-2001 3Dconnexion
Permission to use, copy, modify, and distribute this software for all purposes and without fees is hereby granted provided that this copyright notice appears in all copies. Permission to modify this software is granted and 3Dconnexion will support such modifications only if said modifications are approved by 3Dconnexion