DIY SpaceMouse

DIY SpaceMouse

christoph
Observer Observer
5,558 Views
5 Replies
Message 1 of 6

DIY SpaceMouse

christoph
Observer
Observer

Hey guys, 

 

I'm wondering if I can build a SpaceMouse like the one from 3DConnection myself. 

I'm a mechanical engineer, so I'm about to design the mouse atm from a mechanical perspective but I can't find any Hotkeys to move the view inside 3D Construction...
I'd like to connect my Arduino like a mouse/keyboard to the PC but it seems, there is no shortcut to move, rotate or pan the view without moving the mouse. Is it possible to write an app to solve this issue?

Has anyone already thought about this?

 

Would like to hear, that it's already been done by someone and I just can't find it 😄 

0 Likes
Accepted solutions (1)
5,559 Views
5 Replies
Replies (5)
Message 2 of 6

zxynine
Enthusiast
Enthusiast
Accepted solution

Yes, it absolutly is possible, you just need to use the camera object from application.activeviewport.camera, then change its eye,target,and upvector! That gives you full control over the view. Additionally, make sure you are using the right arduino, only specific ones are capable of behaving like a usb device. I would reccomend i think the raspberry pi pico(4$) is capable of doing it and would be more familiar since it will use python. Also an esp32(~7$) is capable of acting like a bluetooth device and using wifi and can be programmed using arduino or circuit python so those are better options for you.

 

I have a class in my utils repo I use for the camera, you will need to change some of the code to fit what you need, also it is just a dummy class to group functions so it shouldnt be instantiated, but this should give you an idea of some common functions you will use when changing the camera:

 

class camera:
	def get(): return AppObjects.GetApp().activeViewport.camera
	
	def viewDirection(camera_copy:adsk.core.Camera=None):
		camera_copy = camera_copy or camera.get()
		return camera_copy.eye.vectorTo(camera_copy.target)

	def updateCamera(camera_copy:adsk.core.Camera, smoothTransition=True):
		camera_copy.isSmoothTransition = smoothTransition
		AppObjects.GetApp().activeViewport.camera = camera_copy
		adsk.doEvents()

 

Message 4 of 6

info83PHN
Advocate
Advocate

cheap generic gamepad ( $10 ) and the free opensource Anti Micro software to map the joysticks and buttons to whatever you want in Fusion.

 

It also has auto-detect for apps, so for my use, the pan / rotate / zoom on the gamepad joysticks work exactly the same for Fusion, Blender, MeshMixer, Netfabb, etc. ( whereas the normal mouse / k/board sequence differs for each software )

 

0 Likes
Message 5 of 6

12102588
Observer
Observer

A4092DCD-FA7E-417C-B360-F06E4422841A.jpeg

Hello,

I am currently working on a spacemouse myself, using a motion tracking arm with 6 degrees od freedom. I am using a serial connection in my python script over the COM ports to read the data coming from the arduino. When I am trying to execute the script inside fusion360, it crashes. 

What type connection between the arduino and the script would you use? And do you have a sample script for an arduino being used inside an API script?

 

thank you in advance!

 

best regards,

 

lukas

Message 6 of 6

BrianEkins
Mentor
Mentor

I suspect you're running into a threading issue. The Fusion API is single-threaded and runs in the main Fusion thread. There is a workaround to this where your code that is talking to the Arduino is running in a separate thread but when you need to use the Fusion API to interact with Fusion, you fire a custom event so the code that uses the API will be running in the main thread. This is documented here: https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-F9FD4A6D-C59F-4176-9003-CE04F7558CCC

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com