In order to use our libraries in your .NET application, please install one or more of the following NuGet packages:
- Photomechanics.Photo3DStudio.TurntableControl.Mft: provides control over the following turntables:
- MFT (manufactured after June 2018)
- Photomechanics.Photo3DStudio.TurntableControl.Legacy: provides API implementation for old MFT/RD-60 turntables
- Photomechanics.Photo3DStudio.TurntableControl.RD300: provides API implementation for RD-300 platform
- Photomechanics.Photo3DStudio.TurntableControl.DeviceDiscovery: provides turntable manager service which automatically searches and connects to turntable
- Currently detects only turntables supported by Mft package.
Upon installing any of these packages NuGet should automatically install the following dependencies:
- Photomechanics.Photo3DStudio.Common and Photomechanics.Photo3DStudio.TurntableControl packages that provide base turntable API types
- Serilog: we use it for logging
Turntable specific packages also have following dependencies:
- System.IO.Ports and Microsoft.Win32.Registry used to access COM ports (for USB connected turntables)
- NModbus for RD300 control
Device and features support will be extended over time as we continue to develop new turntable models and Photo3DStudio.
Note: Due to the fact that
System.IO.Ports requires windows-specific functionality,
MFT API is currently unlikely to work on non-Windows OS. Please contact support if you need to use this library on non-Windows machines.
The following guide assumes most common use case: you have installed
DeviceDiscovery packages and have your turntable connected via USB.
Documentation for all our packages can be found at https://developer.photomechanics.com/dotnet-api/annotated.html where you can find detailed description of all types in our packages.
The following example shows how to open connection with turntable (assuming it is visible in system device manager as
MftApi (which is implementation of
ITurntableApi) are disposable and also wrap each other. If any of them is disposed, all other components will be disposed.
For example, if messages transport encountered an error (lost connection or received invalid text), it will log this event and trigger disposal of serial port and command runner, which will trigger disposal of API object itself.
Disposed event of
ITurntableApi to handle this situation (for example, attempt to reconnect). Disposal of all components will also be logged.
You can automatically connect to USB turntable using
DeviceDiscovery package. The
ITurntableManagerService will do all the work for you:
ITurntableApi serves as the holder of components. Each component type encapsulates some group of functionality. For instance, all turntables have
IRotationProvider that contains basic methods for rotation. If turntalbe uses stepper motor, it is likely to have
IEngineLockControlProvider and so on.
The following example shows how to perform simple 360 degree rotation:
GetComponent will return
null if requested component is not supported by your device. You can also use
HasComponent method if you only need to check for feature support.