OpenSCAD用户手册/输入设备

简介 编辑

[请注意: 需要使用版本 2019.05]


用户借助输入驱动(inputdriver)即可在OpenSCAD中使用游戏手柄或3D鼠标等设备。

下列驱动程序正在开发中:

  • HIDAPI - 常用于MacOS与Windows系统 - 要用到USB IDs / 此驱动也可运用于Linux,但是需要用到其他特权,所以这种驱动对于用户而言并不理想。
  • Joystick驱动 - 用于Linux操纵杆设备 (当前固定位于 /dev/input/js0)
  • SpaceNav驱动 - 使用spacenavd daemon
  • DBus driver - 仅用于Linux / not for actual devices but for remote control
  • QGamepad - 用于跨平台支持操纵杆设备 - 似乎在Qt级别上要做一些额外的配置工作,因此,为了让其更易使用还要多费些力气

默认的坐标轴映射是针对3D鼠标的。

如何尝试 编辑

输入驱动属于开发快照(development snapshot)的一部分,并夜以继日地构建中。

因此,您可以在这里找到它:http://www.openscad.org/downloads.html#snapshots

游戏操纵杆与游戏手柄 编辑

linux 编辑

 
Almost any controller that your Linux computer recognizes should work

JoystickInputDriver使用的设备为/dev/input/js0.

在Ubuntu Linux下,您需要joystick包来支持操纵杆设备。

QGamepad can also be used, but is not recommended as the QGamepad Driver makes assumptions about the Gamepad that might not be true.

Windows 编辑

 
QGamepad works well with XBox 360 controllers

在Windows下,您可用QGamepad作为驱动。 QGamepad与XBox 360控制器配合最佳。

3D鼠标 编辑

Linux 编辑

On Linux, the easiest way with the Space Mouse Wireless is interestingly to go though the Joystick driver which is normally enabled on most systems.

Spacenav 编辑

Spacenav is also supported. http://spacenav.sourceforge.net/ https://wiki.archlinux.org/index.php/3D_Mouse#Open_Source_Drivers

sudo apt-get spacenavd

On debian:

sudo  apt install libspnavd-dev 

(requires restart)

HIDAPI 编辑

对于使用hidapi驱动的情况而言,您能以根权限来运行openscad。这里并不推荐您这样做,但是此法有助于临时排除故障。

Much better is to figure out which vendor id and product id your device has and add a udev rule. To figure out which vendor and product id your product has, you can use lusb.

How the relevant line of lsusb may look like:

Bus 002 Device 006: ID 046d:c627 Logitech, Inc. 3Dconnexion Space Explorer 3D Mouse

有关参考:

  * https://stackoverflow.com/questions/3738173/why-does-pyusb-libusb-require-root-sudo-permissions-on-linux/32022908#32022908

Windows 编辑

OpenSCAD利用HIDAPI直接与3D鼠标进行交互。

因此,并不需要设备生产商提供的驱动。 如果已经安装了设备生产商给出的驱动,必须将其停用,这样,OpenSCAD方可获取此设备的控制权。

有几种停用此驱动的方式。在开始菜单中应当会有个3Dconnexion文件夹,里面有"Stop Driver"。

您还可尝试

"C:\Program Files\3Dconnexion\3DxWare\3DxWinCore64\3DxService.exe" -shutdown

Mac OS 编辑

如同其他平台一样,您必须完全禁用原生的3DConnexion驱动,因为OpenSCAD不会用到它们。

为了开启内建的SpaceMouse驱动,请依次点击Preferences → Axes,开启HIDAPI设置,并重启OpenSCAD。

下列设备已经过测试,且已知可与MacOS Mohave下的OpenSCAD协同工作:

  • SpaceMouse Compact (USB)
  • SpaceMouse Wireless

DBus 编辑

 
维基百科中的相关条目:

驱动可用于远程控制OpenSCAD。

This is mainly intended for programmers. It can for example be used to write a custom input driver.

调试与测试 编辑

对于调试与测试而言,可以使用D-Feet。在org.openscad.OpenSCAD下的Session Bus即可找到OpenSCAD。

不推荐使用qdbus,因为其中有数据结构过于复杂等问题。

示例 编辑

可以在此找到一个针对QT/C++的示例 this page.

摄像机系统 编辑

请注意,OpenSCAD的摄像机系统及其行为并非按标准方式进行操作。通过DBus,您将直接与OpenSCAD的摄像机进行交互。请注意,摄像机系统及其界面可以在某些时刻进行重构。

Actions 编辑

Please note that the actions exposed Via dbus are mostly the ones from the Menu Bar of OpenSCAD. Keep in mind, that the menu bar might change at some point and that compatibility with the dbus driver is not of concern.

FAQ 编辑

按钮是如何映射的? 编辑

打开preferences,进入button选项卡,再按下待映射的按键。与之关联的下拉选择框文本将显示为红色加粗字体。

View is drifting 编辑

If your view is drifting, please re-calibrate the neutral position and deadzone of your input device. This can be done within OpenSCAD or with the tools of the operating system.

我的设置存于何处? 编辑

参见 this page.

Y+Viewport-rel-translation (VRT) Channel is not responding to input 编辑

You are in orthogonal view. Please change it to perspective to see what it does. Or look in the bottom left corner, where translate = changes. This is not a bug, this is a very specific feature. When you map zoom to one axis and Y+Viewport-rel-translation to an other while in perspective view, you should get the vertigo effect. Most users will therefor use zoom as it works in both orthogonal and perspective. Before you wonder why you can map two axis to zoom: Game controllers have two shoulder buttons.

是的,这项功能实际上很少用到,但是输入设备将提供给用户更多操控的可能性。