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[編輯]

Wikipedia-logo.png
維基百科中的相關條目:

驅動可用於遠程控制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.

是的,這項功能實際上很少用到,但是輸入設備將提供給用戶更多操控的可能性。