Use Python to Create User Subroutines
MotionSolve user subroutines can be written in Python. This facility allows you to describe complex phenomena in a powerful scripting language.
Starting in MotionSolve 2020, Python 3.5 from ActiveState is included in the installation. This includes two major Python packages, NumPy (http://numpy.scipy.org/) and SciPy (http://scipy.org) to be used in the user subroutines.
- A powerful N-dimensional array object.
- Sophisticated (broadcasting) functions.
- Tools for integrating C/C++ and Fortran code.
- Useful linear algebra, Fourier transform, and random number capabilities.
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and quickly integrate with a wide variety of databases. NumPy is licensed under the BSD license, enabling reuse with few restrictions.
SciPy is a collection of mathematical algorithms and convenience functions built on the NumPy extension for Python. It adds significant power to the interactive Python session by exposing you to high-level commands and classes for the manipulation and visualization of data. With SciPy, Python transforms into a data processing and system-prototyping environment rivaling systems such as MATLAB.
The additional benefit of using SciPy within Python, however, is that a powerful programming language is also available for use in developing sophisticated programs and specialized applications. Scientific applications written in SciPy benefit from the development of additional modules in numerous domains created by developers across the world. Everything from parallel programming to web and database subroutines and classes have been made available to you. All of this is available in addition to the mathematical libraries in SciPy.
This is available for use within the MotionSolve user-subroutines. A sample set of user subroutines written in Python is available for reference in the installation at <installation_directory>\hwsolvers\motionsolve\usersub\py_src.