LivePrinter: Livecoding meets 3D printing
Experiments in live computational sculpting
There's a forum on https://talk.lurk.org/channel/liveprinter
You can join our email list to keep up to date with performances, demonstrations, workshops, and important updates.
Evan is on Twitter at @evanraskob and can answer questions, etc.
We can create a Reddit forum or YouTube channel if there is demand for it.
Installing and Running
The server runs on Python 3 (3.6 and 3.7 tested) so you will need that installed. Then, use pip (the Python package manager) to install:
- pyserial (tested with 3.4)
- tornado (tested with 5.0.2)
- json-rpc (tested with 1.11.0)
Here is a short video demonstrating the python installation on Windows (on OS X it's the same, just use Terminal instead of Command Prompt): https://youtu.be/ejlaQhOCUHw
Run the server using your Python environment of choice * it's in the liveprinter folder, called LivePrinterServer.py. By default, the server runs on port 8888 so open a web browser to http://localhost:8888 (or change it). It can run without a printer using a "fake" serial port.
LivePrinter is an open source system for live, immediate drawing and fabrication with 3D printers. It’s particularly useful for:
- Textile artists who want to print onto fabrics and make new shapes and textures; for artists who want to use a printer like a 3D plotter and draw new forms
- Product and industrial designers who want to understand more about how 3D printing works and fine-tune their materials and tool paths
- Materials scientists who want to study 3D printing materials in more controlled, repeatable ways
- Computational and computer artists, either looking for new tools or making generative works
- Educators who teach fabrication
- HackSpace and MakerSpace staff who need more tools to fine-tune their machines
LivePrinter combines the design and 3D printing of objects into a single, iterative process. Livecoding is used to control manufacturing precisely and procedurally with real-time flexibility. It brings improvisation and intuition to the act of making new computational forms. The system extends digital printing and CNC machining into the realm of performance and also has potential in design and science pedagogy.
The current software toolchains of 3D printing place the artist and designer at a difficult distance from the physical process of making. There is little space for live improvisation and experimentation, especially with key properties that directly affect printing materials, like temperature and print speeds.
LivePrinter is designed to be:
- Flexible in deployment: it should run on as many platforms as possible (Raspberry PI and other Linux and RTOS systems as well as standard computers such as desktops and laptops)
- Easy to hack: the system architecture itself should not have too many dependencies or be generally too elaborate and complex. It should stick to minimal, necessary features. It should favor less code files that do more over many files that interact in complex ways. Important code that will edited often should be foregrounded. This goes for the livecoding mini-languages as well.
- Allow for as little lag as possible: physically making things happens in realtime, and even milliseconds count when you have melted plastic cooling.
- Be quick and intuitive to code: the livecoding system should be as minimally-verbose as possible so it can be typed quickly. It should also provide enough core, useful functions so that common making actions are supported.
- Be as honest as possible with physical states: the code should not try and cache physical properties like temperature and print head position, for example. These relate to instantaneous reality and should be treated as such. A query/response system is one such solution.
- Be understandable and appropriate for artists, designers, and non-technical people: This is a (fun!) tool for making intuitively, and the language should reflect that, even at the expense of technical accuracy (of language).
- Be collaborative, social, performative: Allow for others to take part in the making process, whether that's contributing directly to the livecoding or spectating as audience.
How It Works / Developing
LivePrinter is part web client and server for livecoding and part 3D printer host application on the back end. On the front end, a user will livecode in a web browser (or other web client). Their code is compiled into machine-appropriate G-Code and sent via JSON-RPC over websockets to the back end, where it is sent to the printer via a serial connection. Responses from the printer are sent back to the web client.
More than one person might be involved: the system is designed to support collaborative livecoding and potentially many 3D printers, as complex as that is! (Look at the Max/MSP example in the misc folder for an example of this)
- liveprinter.js: handles the user interface and communication with server (sends GCode, handles events)
- printer.js: the 3D printer API (outputs GCode to be sent to the printer)
- LivePrinterServer.py: The back-end web server (uses tornado and websockets), implements the JSON-RPC API
- USBPrinterOutputDevice.py: the Marlin driver that handles serial communication
The back-end web server and websockets service uses a Tornado server written in Python and a very-adapted version of Cura's 3D printing driver that connects to a Marlin Firmware based 3D printer (currently tested on an Ultimaker 2+) and on various Prusa printers, as well as homebrew Marlin-based ones.
Getting Involved / Contributing
If you want to get involved, please give us a shout! The more the better.
There is an API and function reference for the client end which needs formatting work.
An aside on Python Virtual Environments
It makes sense (in general, not just for this project) to do Python development using isolated virtual environments, to prevent contamination or clashes between modules and utilities by keeping all configuration sandboxed. This requires a global installation of
virtualenv. After that we can do (on macOS and Linux at least):
virtualenv --python=python3 ~/Desktop/venv3 # create a Python 3 virtual environment . ~/Desktop/venv3/bin/activate # activate the environment pip install --upgrade pip # get the latest pip in the virtual environment (probably not essential) pip install tornado pyserial json-rpc # get the libraries we need python LivePrinterServer.py # launch the server in the Python 3 sandbox
virtualenv --python=AppData\Local\Programs\Python\Python37\python.exe Desktop\venv3 Desktop\venv3x\Scripts\activate
Then when all is done:
deactivate # wind down the environment
License and Dependencies
LivePrinter is completely open source (AGPL 3.0). To summarise, it is built on and inspired by other open source projects:
- OpenGB has been an inspiration
- Fabrica, a front-end for Smoothieware looks interesting. Smoothieware integration might be nice, someday.
Who is behind this
This project was started by Evan Raskob, artist, livecoder and Lecturer at Goldsmiths University (previously at the Royal College of Art in London), and part-time PhD student in arts and Computational Technology also at Goldsmiths. This project is the main practice part of his ongoing PhD study. If you'd like to get in touch, please email him at email@example.com.