FAQ FAQ   Search Search   Memberlist Memberlist   Usergroups Usergroups   Register Register 
3Dconnexion.com
3Dconnexion Forum 
  Profile Profile   Log in to check your private messages Log in to check your private messages  Log inLog in 

 3Dconnexion.com Forum Index » Developer's Forum for Windows » Where's the SDK?
 Goto page 1, 2, 3  Next The time now is Thu Sep 09, 2010 5:18 am 

 Post new topic   Reply to topic View previous topic :: View next topic  
Author Message
PostPosted: Wed May 09, 2007 1:29 pm    Post subject: Where's the SDK?  Reply with quote  

mika



Joined: 09 May 2007
Posts: 2

Where do I get the SKD? The CD-ROM that came w/ the product doesn't seem to contain it and it doesn't seem to be online under the SDK download page (http://www.3dconnexion.com/support/4f.php).

What I'm looking for is all the files referred to in WindowsSDKGuide.pdf: i.e. files in %SDK% which by default is C:\Program Files\3Dconnexion\3DxWare SDK\

Thanks for the help

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed May 09, 2007 1:37 pm    Post subject:  Reply with quote  

jwick
Moderator
Moderator


Joined: 20 Dec 2006
Posts: 983
Location: USA

Hi mika,

3DxInput is a COM DLL (named TDxInput.dll). It comes with the driver and is registered by the installation program. There is nothing more to install.

If you want the old C/C++ SDK, you have to download that from the archive section of the support page.

Jim
3Dx Software Development

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Fri May 11, 2007 12:04 pm    Post subject:  Reply with quote  

mika



Joined: 09 May 2007
Posts: 2

Perfect! The COM interface is just what I needed for interfacing w/ python

TOP View user's profileSend private message  BOTTOM
PostPosted: Fri May 11, 2007 12:17 pm    Post subject:  Reply with quote  

jwick
Moderator
Moderator


Joined: 20 Dec 2006
Posts: 983
Location: USA

Excellent.
Please feel free to post any hints or examples you have for other Python developers.

Jim
3Dx Software Development

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Mon May 14, 2007 3:25 am    Post subject:  Reply with quote  

vloewis



Joined: 14 May 2007
Posts: 1

Hi mika,

how do you interface w/ python?

My attempt so far:
import win32com.client
sn = win32com.client.Dispatch("TDxInput.Device")
sn.Connect()
print sn.Type
6
print sn.Sensor.Translation.X
0.0

I always get 0.0 no matter what i do, or which axis Trans/Rot
i query (yes i've been moving it Confused)

Hints & pointers appreciated, pref src.

SpaceNavigator 3.3.2

Patric

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed May 16, 2007 9:18 am    Post subject: still questions  Reply with quote  

rxnnxs



Joined: 16 May 2007
Posts: 3

dear jwick,

i dont understand why the pdf about the WindowsSDKguide still refers about the sdk-install options.
i was looking forward to program, but it isnt that easy.
the code samples wont run with msvs6 and there has to be more than just one dll. in the pdf many libs are mentioned and i would be glad if we get a bit more information where to get them.

there was talked about an archive on this homepage, but i cant find an archive where i can download older source-files.

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed May 16, 2007 11:31 am    Post subject:  Reply with quote  

ngomes
Moderator
Moderator


Joined: 27 Nov 2006
Posts: 1140
Location: EU

Hi rxnnxs,

Please make sure you check the documentation available on the SDK page (not the Archive).

The 3Dconnexion SDK page is available here. You will find in there a link to a web seminar presentation that can be very useful to get you started.
_________________
Nuno Gomes

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Fri May 18, 2007 10:13 am    Post subject:  Reply with quote  

ngomes
Moderator
Moderator


Joined: 27 Nov 2006
Posts: 1140
Location: EU

Hi vloewis,
Quote:
Hints & pointers appreciated, pref src.

Are you instantiating the "Device" object in the main thread? Make sure there the thread has a message pump, otherwise the event notification won't work and you will always get a zero (the default) on any of the axes.

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Wed May 23, 2007 5:33 am    Post subject:  Reply with quote  

Martijn Kragtwijk



Joined: 16 May 2007
Posts: 3

Hi, I'm also struggling to get the data from my SpaceNavigator using Python. I'm new to COM, win32 message pumps etcetera, so if anyone has a working code sample that would help me a lot!

Thanks,

Martijn

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed May 23, 2007 7:46 am    Post subject:  Reply with quote  

Martijn Kragtwijk



Joined: 16 May 2007
Posts: 3

Ok folks, I've managed to get something working myself, based on a NeHe example (using pyopengl). Looks like this:

Code:
#!/usr/bin/env python

from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys

import win32com.client
sn = win32com.client.Dispatch("TDxInput.Device")
sn.Connect()

ESCAPE = '\033'

# Number of the glut window.
window = 0

x = 0
y = 0
z = 0
rot_x = 0
rot_y = 0
rot_z = 0

# A general OpenGL initialization function.  Sets all of the initial parameters.
def InitGL(Width, Height):            # We call this right after our OpenGL window is created.
    glClearColor(0.0, 0.0, 0.0, 0.0)   # This Will Clear The Background Color To Black
    glClearDepth(1.0)               # Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS)            # The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST)            # Enables Depth Testing
    glShadeModel(GL_SMOOTH)            # Enables Smooth Color Shading
   
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()               # Reset The Projection Matrix
                              # Calculate The Aspect Ratio Of The Window
    gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)

    glMatrixMode(GL_MODELVIEW)

# The function called when our window is resized (which shouldn't happen if you enable fullscreen, below)
def ReSizeGLScene(Width, Height):
    if Height == 0:                  # Prevent A Divide By Zero If The Window Is Too Small
       Height = 1

    glViewport(0, 0, Width, Height)      # Reset The Current Viewport And Perspective Transformation
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)
    glMatrixMode(GL_MODELVIEW)

def updateSensorData():   
   global x, y, z, rot_x, rot_y, rot_z

   Tx = float(sn.Sensor.Translation.X)
   Ty = sn.Sensor.Translation.Y
   Tz = sn.Sensor.Translation.Z
   Rx = float(sn.Sensor.Rotation.X)
   Ry = sn.Sensor.Rotation.Y
   Rz = sn.Sensor.Rotation.Z
   
   print 'Tx', Tx,
   print 'Ty', Ty,
   print 'Tz', Tz,
   print 'Rx', Rx,
   print 'Ry', Ry,
   print 'Rz', Rz
      
   x += 0.01*Tx
   y += 0.01*Ty
   z += 0.01*Tz   
      
   rot_x += Rx
   rot_y += Ry
   rot_z += Rz
      
# The main drawing function.

def DrawGLScene():
   global x, y, z, rot_x, rot_y, rot_z
   updateSensorData()

   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);   # Clear The Screen And The Depth Buffer
   

   glLoadIdentity()
   glTranslatef(0.0, 0.0,-7.0)      # Move Right And Into The Screen
   
      
   glTranslate(x, y, z)
   
   glRotatef(rot_x, 1.0, 0.0, 0.0)
   glRotatef(rot_y, 0.0, 1.0, 0.0)
   #glRotatef(rot_z, 0.0, 0.0, 1.0)
   
   #glRotatef(rquad,1.0,1.0,1.0)      # Rotate The Cube On X, Y & Z
   glBegin(GL_QUADS)         # Start Drawing The Cube


   glColor3f(0.0,1.0,0.0)         # Set The Color To Blue
   glVertex3f( 1.0, 1.0,-1.0)      # Top Right Of The Quad (Top)
   glVertex3f(-1.0, 1.0,-1.0)      # Top Left Of The Quad (Top)
   glVertex3f(-1.0, 1.0, 1.0)      # Bottom Left Of The Quad (Top)
   glVertex3f( 1.0, 1.0, 1.0)      # Bottom Right Of The Quad (Top)

   glColor3f(1.0,0.5,0.0)         # Set The Color To Orange
   glVertex3f( 1.0,-1.0, 1.0)      # Top Right Of The Quad (Bottom)
   glVertex3f(-1.0,-1.0, 1.0)      # Top Left Of The Quad (Bottom)
   glVertex3f(-1.0,-1.0,-1.0)      # Bottom Left Of The Quad (Bottom)
   glVertex3f( 1.0,-1.0,-1.0)      # Bottom Right Of The Quad (Bottom)

   glColor3f(1.0,0.0,0.0)         # Set The Color To Red
   glVertex3f( 1.0, 1.0, 1.0)      # Top Right Of The Quad (Front)
   glVertex3f(-1.0, 1.0, 1.0)      # Top Left Of The Quad (Front)
   glVertex3f(-1.0,-1.0, 1.0)      # Bottom Left Of The Quad (Front)
   glVertex3f( 1.0,-1.0, 1.0)      # Bottom Right Of The Quad (Front)

   glColor3f(1.0,1.0,0.0)         # Set The Color To Yellow
   glVertex3f( 1.0,-1.0,-1.0)      # Bottom Left Of The Quad (Back)
   glVertex3f(-1.0,-1.0,-1.0)      # Bottom Right Of The Quad (Back)
   glVertex3f(-1.0, 1.0,-1.0)      # Top Right Of The Quad (Back)
   glVertex3f( 1.0, 1.0,-1.0)      # Top Left Of The Quad (Back)

   glColor3f(0.0,0.0,1.0)         # Set The Color To Blue
   glVertex3f(-1.0, 1.0, 1.0)      # Top Right Of The Quad (Left)
   glVertex3f(-1.0, 1.0,-1.0)      # Top Left Of The Quad (Left)
   glVertex3f(-1.0,-1.0,-1.0)      # Bottom Left Of The Quad (Left)
   glVertex3f(-1.0,-1.0, 1.0)      # Bottom Right Of The Quad (Left)

   glColor3f(1.0,0.0,1.0)         # Set The Color To Violet
   glVertex3f( 1.0, 1.0,-1.0)      # Top Right Of The Quad (Right)
   glVertex3f( 1.0, 1.0, 1.0)      # Top Left Of The Quad (Right)
   glVertex3f( 1.0,-1.0, 1.0)      # Bottom Left Of The Quad (Right)
   glVertex3f( 1.0,-1.0,-1.0)      # Bottom Right Of The Quad (Right)
   glEnd()            # Done Drawing The Quad

   #  since this is double buffered, swap the buffers to display what just got drawn.
   glutSwapBuffers()

# The function called whenever a key is pressed. Note the use of Python tuples to pass in: (key, x, y) 
def keyPressed(*args):
   # If escape is pressed, kill everything.
    if args[0] == ESCAPE:
       glutDestroyWindow(window)
       sys.exit()

def main():
   global window

   glutInit(sys.argv)

   # Select type of Display mode:   
   #  Double buffer
   #  RGBA color
   # Alpha components supported
   # Depth buffer
   glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
   
   # get a 640 x 480 window
   glutInitWindowSize(640, 480)
   
   # the window starts at the upper left corner of the screen
   glutInitWindowPosition(0, 0)
   
   # Okay, like the C version we retain the window id to use when closing, but for those of you new
   # to Python (like myself), remember this assignment would make the variable local and not global
   # if it weren't for the global declaration at the start of main.
   window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99")

      # Register the drawing function with glut, BUT in Python land, at least using PyOpenGL, we need to
   # set the function pointer and invoke a function to actually register the callback, otherwise it
   # would be very much like the C version of the code.   
   glutDisplayFunc(DrawGLScene)
   #glutDisplayFunc()
   
   # Uncomment this line to get full screen.
   # glutFullScreen()

   # When we are doing nothing, redraw the scene.
   glutIdleFunc(DrawGLScene)
      
   # Register the function called when our window is resized.
   glutReshapeFunc(ReSizeGLScene)
   
   
   # Register the function called when the keyboard is pressed. 
   glutKeyboardFunc(keyPressed)
   
   # Initialize our window.
   InitGL(640, 480)

   
# Print message to console, and kick off the main to get it rolling.
print "Hit ESC key to quit."

if __name__ == '__main__':
   try:
      GLU_VERSION_1_2
   except:
      print "Need GLU 1.2 to run this demo"
      sys.exit(1)
   main()
   glutMainLoop()


What struck me as odd is that the rotation values seem to be either exactly 0.0 or 1.0 or -1.0 when I have only one axis rotated, and something in between when more than one axis is non-zero. Is this normal?

Martijn

TOP View user's profileSend private message  BOTTOM
PostPosted: Wed May 23, 2007 10:08 pm    Post subject:  Reply with quote  

mbonk
Moderator
Moderator


Joined: 04 Dec 2006
Posts: 130

Martijn Kragtwijk wrote:

What struck me as odd is that the rotation values seem to be either exactly 0.0 or 1.0 or -1.0 when I have only one axis rotated, and something in between when more than one axis is non-zero. Is this normal?


3DxInput v1.0 API wrote:
10. AngleAxis Object
The AngleAxis object provides a representation for orientation in 3D space using an angle and an axis. The rotation is specified by a normalized vector and an angle around the vector. The rotation is the right-hand rule.


This means that sqrt(Rx * Rx + Ry * Ry + Rz * Rz) will always be 1.
Another point to note is that Rx*Angle is not an Euler angle and that
rot_x += Rx is mathematically incorrect.

I would suggest having a look at the xna sample as to how this is done correctly.

Markus

TOP View user's profileSend private message  BOTTOM
PostPosted: Tue Aug 07, 2007 3:33 am    Post subject:  Reply with quote  

calli



Joined: 07 Aug 2007
Posts: 12

Hi,

I am also trying to use the Space Navigator in Python. Because I had some problems installing PythonGL (more GLUT was bailing out), I stripped Martijn's exapmple to a non GL Version.

However I now have the problem only getting zeros as result.

As I understand from this discussion it is because of a missing "message pump".

- What is a "message pump"
- how can I implement on in Python?
- why can`t we have a function just reading out the values?

I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.

Best regards,
Carsten

TOP View user's profileSend private message  BOTTOM
PostPosted: Tue Aug 07, 2007 3:37 am    Post subject:  Reply with quote  

ngomes
Moderator
Moderator


Joined: 27 Nov 2006
Posts: 1140
Location: EU

Hi calli,
Quote:
I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.

I'm not sure it applies here but a beta program of the solution for Blender and 3D mice started today. More information is available here.

TOP View user's profileSend private messageVisit poster's website  BOTTOM
PostPosted: Tue Aug 07, 2007 3:45 am    Post subject:  Reply with quote  

calli



Joined: 07 Aug 2007
Posts: 12

ngomes wrote:
Hi calli,
Quote:
I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.

I'm not sure it applies here but a beta program of the solution for Blender and 3D mice started today. More information is available here.


No thats not what I am for. I extended the Gameengine in Blender (realtime graphics) with some devices so far and want to do the same for the SN.

So I am for a solution to get the data in pure Python (as example) and then use it inside the realtime engine (runtime scripts). I am not sure I can work with threads inside these scripts....

Carsten

TOP View user's profileSend private message  BOTTOM
PostPosted: Tue Aug 07, 2007 5:16 am    Post subject:  Reply with quote  

ngomes
Moderator
Moderator


Joined: 27 Nov 2006
Posts: 1140
Location: EU

Hi calli,
calli wrote:
- What is a "message pump"
- how can I implement on in Python?
- why can`t we have a function just reading out the values?

A "message pump" is what is generally called the Windows feature of transmitting "messages" between the system and applications.
Are you able, on your Python script, to process raw Windows messages? Like WM_ACTIVATE or WM_PAINT?

TOP View user's profileSend private messageVisit poster's website  BOTTOM
 Post new topic   Reply to topic All times are GMT - 8 Hours

Display posts from previous:    Goto page 1, 2, 3  Next
 3Dconnexion.com Forum Index » Developer's Forum for Windows » Where's the SDK?
 Page 1 of 3
 
 
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Jump to:  


     Powered by phpBB © 2001, 2005 phpBB Group | Template Neon v1.3 | Crystal