Skip to content

A tool to manipulate the camera of Cura using a space mouse

License

Notifications You must be signed in to change notification settings

renegadecitizen/SpaceMouseTool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This Cura plugin allows to use a 3Dconnexion space mouse to rotate, and pan the camera in Cura.

Supported Platforms

The plugin should work on Mac OSX, Linux, and Windows. I successfully tested it on

  • Mac OSX 10.13.6 (High Sierra),
  • Ubuntu 16.04 (Xenial),
  • Ubuntu 18.04 (Bionic), and
  • Window 10 Pro

each running Cura 4.6.1.

If desired I could also provide libs for ARM architectures such as used by the Raspberry Pi B, 2B, and 3B.

State of development

Currently implemented

  • Free movement (translation and rotation) of the camera around the current rotation center using a free orbit.
  • Rotation of camera around the current rotation center using a constrained orbit as already implemented in Cura using standard mouse interaction.
  • To switch between free and constrained movement go to ExtensionsSpace Mouse Tool and click on Toggle free/constrained orbit.
  • The same rotation center as when rotating with the mouse is used. Especially when center selected model is activated in Cura the camera will rotate around that model.
  • Top, Right, Front buttons of the space mouse work as expected, i.e. they move the camera to top, right, or front view, respectively.
  • Additionally when holding down Shift either on the space mouse (if it has such a key) or on the keyboard while hitting Top, Right, or Front, the corresponding other side is shown, i.e. the camera moves to bottom, left or rear view.
  • The Rot CW button of the space mouse works as expected, i.e. it rotates the space clockwise around the view axis by 90 degrees.
  • Again holding down Shift on the space mouse or on the keyboard will cause the camera to rotate counterclockwise around that axis by 90 degrees.
  • Pressing the Fit button while one or multiple models are selected will translate/zoom the camera in such a way that those objects are centered and completely visible in the viewport (there is still a little bug here, as the top banner of Cura overlaps the viewport and thus the selected models, I will fix this when I have the time).
  • The modifier keys, Shift, Ctrl, and Alt work as expected (on linux, on OSX and Windows you can just map them on the corresponding keyboard keys using the 3DConnexion configuration tool), i.e. they send the appropriate keyboard signal to Cura. I'm not aware of any place where the Esc key is used in Cura, but if there is one enlighten me, and I will try to also add it.
  • Rotation lock works on all platforms. On Windows and OSX it can/must be configured in the 3DConnexion interface. In Linux the plugin takes care of dis- and enabling the camera-rotation.

Plans for future development (descending by importance)

  • Rotation lock on linux (included in v1.1.0)
  • Constraint orbit movement (included in v1.1.0)
  • Menu button to open Print settings
  • Esc key support if required
  • Maybe include the plugin in the Cura marketplace
  • I'm always open for suggestions and contributions

Installation

Prerequirements

Mac OSX / Windows

You need to have the 3Dconnexion drivers installed and running to use the plugin. Those can be found on their website.

Linux

You need to have the spacenavd daemon installed and running to use the plugin. On Ubuntu, e.g., you can install it using aptget via the command

sudo apt install spacenavd

Installation of the plugin itself

  1. Open Cura.
  2. Go to Help -> Show Configuration Folder. This will open the folder holding your personal Cura configurations and plugins.
  3. Close Cura (you will have to restart Cura to make the new plugin available anyway).
  4. Download the latest release of this plugin.
  5. Extract the downloaded file into the plugins folder inside the folder found in 2.
  6. Start Cura.
  7. Enjoy.

Configuration of the spacemouse

Mac OSX

Use the configuration tool provided with the 3Dconnexion Driver. It can be found in the System Preferences under the 3Dconnexion entry. Select Ultimaker Cura in the drop or use Add Application... to add it if it is not listed yet.

Windows

Use the configuration tool provided with the 3Dconnexion Driver. It can be found in the Start Menu under 3Dconnexion -> 3Dconnexion Properties. Note that you need to have Cura open in the background in order for the configuration tool to recognize the app for which you want to customize the space mouse.

Linux

You can use the graphical tool provided here to customize the behavior of your space mouse.

Building the plugin from source

Prerequirements

Mac OSX / Linux

  • You will need Python 3.5 with pymalloc deactivated. I built version 3.5.9 from source, as the non-pymalloc version wasn't available through apt-get or macports. To disable pymalloc use the --without-pymalloc flag during configuration.
  • You will also need a standard build environment including g++/gcc, etc.
  • Finally, on Linux you will need the development package of libspacenav. On Ubuntu you can install those using.
sudo apt install libspnav-dev

Windows

  • You will need Python 3.5. I used Python 3.5.4 as it is the latest version of Python 3.5 available on the download page.
  • You will also need Visual Studio 2015 (not that easy to come by without an Microsoft developer account, but the iso image can still be found in a stackoverflow post). At least I used version 2015, but as I'm not normally a Windows developer I don't know whether newer versions will also work.
  • Finally, you will need the 3Dconnexion SDK which is available in the developer section of the 3Dconnexion website (requires you to create an account).

Building the code

  1. Get the source code of the latest release (or any other commit that you want to build) and extract it to the plugins folder of your Cura configuration directory as explained above.
  2. Using the (Power)shell navigate to the src directory inside the extracted folder.
  3. Run
python3.5 setup.py build

to build the library. Make sure to use the python version without pymalloc. 4. If step 3 fails because some symbols or headers were not found, have a look in setup.py and check that the include and link paths are set correctly for your system.

Included dependencies

3Dconnexion SDK

The c++ OSX and Windows libraries included in this plugin are linked against the 3Dconnexion client and 3Dconnexion SDK libraries, respectively.

3D input device development tools and related technology are provided under license from 3Dconnexion. (c) 3Dconnexion 1992 - 2016. All rights reserved.

libspnav library

The c++ linux library included in this plugin is linked against the libspnav library maintained by John Tsiombikas (nuclear@member.fsf.org) The libspnav library is licensed under the modified (3-clause) BSD license:

Copyright (C) 2007-2018 John Tsiombikas nuclear@member.fsf.org
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

A tool to manipulate the camera of Cura using a space mouse

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 63.1%
  • Python 32.4%
  • Shell 4.5%