Vention's Tech Docs

User Manual

User Manual: Python Programming

Gain complete control over your MachineMotion controller with our Python API. This guide takes you through all required steps to deploy your first custom script - whether you're a seasoned Python pro or are just downloading Python for this first time.

The MachineMotion Python API simplifies motion control and provides an intuitive, human-readable way to bring your equipment to life.

Inexperienced programmers should consider using MachineLogic's code-free visual sequence editor instead to create simple motion programs.

Compared to MachineLogic, Python programs are more complicated, but they offer several advantages. They are generally the best choice if you want your application to:

  • Communicate with custom hardware.
  • Involve complex logic.
  • Integrate with third-party software and tools.

For details on 3D design using Vention, datasheets, and more, please visit Vention.io .

Quick start

Once you've connected your MachineMotion controller (see here for details) , running your first Python script is as simple as typing these commands into your terminal:

$ git clone https://github.com/VentionCo/mm-python-api
$ python mm-python-api/examples/demo

Installation

This manual will guide you through five steps to get MachineMotion up and running with the Python API.

  1. Install Python on your computer
  2. Download the MachineMotion API
  3. Download the required libraries
  4. Connect to MachineMotion
  5. Run your first program

Install Python

  1. Go to https://www.python.org/downloads/ to download the latest version of Python installPython1 .

  2. Open and run the installer. If you’re using Windows, make sure you select Add Python to path . installPython3

Download the API

MachineMotion comes with pre-installed controller software. There are two versions of the Python API, so make sure you install the right one. The table below indicates which one to choose.

Controller software Python API Git clone Link
v1.2.11 and earlier Python API v1.6.8 git clone https://github.com/VentionCo/mm-python-api/tree/release/v1.6.8 v1.6.8
v1.12.0 and later Python API v2.0+ git clone https://github.com/VentionCo/mm-python-api/tree/release/v2.2 v1.12.0

If your MachineMotion controller is connected to your computer, you can check its software version here .

Next, open the command prompt (for Windows) or terminal (for Mac or Linux), navigate to your destination folder, and paste the suitable “git clone” command.

(Or follow the download link above and unzip the contents into your directory of choice.)

Need help? See Github's download guide here .

Download libraries

Open the command prompt (for Windows) or the terminal (for Mac or Linux) and run the following installations:

$ pip install -U socketIO-client
$ pip install -U pathlib
$ pip install -U paho-mqtt

The MachineMotion Python library is now installed and ready to use! Continue below to start your first custom program.

Connect to MachineMotion

MachineMotion connects to a laptop through Ethernet. If your laptop does not have an Ethernet port, use the USB to Ethernet converter included with your MachineMotion purchase.

For more info on getting MachineMotion to communicate with your computer or network, see User Manual: MachineMotion .

Run your first program

There are two ways to load a custom Python script onto MachineMotion:

  1. With the command line/terminal.
  2. With the cloud9 IDE.

Command-line programming

  1. Open the command prompt (for Windows) or terminal (for Mac and Linux).

  2. Browse to the directory where the MachineMotion API library is saved:
    cd path/to/folder/mm-python-api/

  3. Execute the demo program with the following line of code:
    python examples/example--demo.py

  4. The demo program will launch. Press q or Ctrl+C to quit anytime.
    commandLine

Cloud9 programming

  1. Open the Cloud9 IDE: http://192.168.7.2:3000/ide.html . cloud91

  2. Copy and paste the mm-python-api folder into Cloud9. cloud92

  3. Navigate to examples/example--demo.py and press F5 or run to execute the program. cloud93

Explore the possibilities

Congratulations on loading your Python API script!

Keep exploring by browsing the sample code in our Python API documentation, Application Programming Interface: Python v1.6.8 .


Feedback on this doc? Please email info@vention.cc with the subject "Technical Documentation".

Release notes: Python v1.6.8 .

Comments (0)