Generative Knitting

Generating Knitting Programs using Custom Script

Generative Knitting

Although flatbed-knitting requires relatively expensive machinery when compared to sewing and embroidery, we did notice its advent in DIY and maker domains, as it provides a powerful means to accurately design and create functional devices from numerous source materials, which can be precisely combined on a loop-level. Modern knitting techniques enable the creation of intricate textile objects, such as 3D-knits, which opens many new opportunities for industrial design, healthcare and monitoring, and specialized clothing, e.g., for protective gear or even space-travel. Flatbed-knitting is therefore sometimes nicknamed “3D-printing for textiles”.

The machines are highly specialized industrial robots which are controlled by software that is specifically tailored to the requirements of the textile industry, i.e., for mass-production. Both hardware and software are highly optimized and require extensive knowledge and training. There is a point to this, as knitting programs are usually puzzled out by expert knitting technicians and, once finished, applied to create a multitude of identical pieces. Furthermore, knitting practice requires in-depth experience with the textile materials in use, which involves frequent trial-and-error steps throughout this learning process. Also, user interfaces are inherently complex to operate for novices and documentation and tuturials are hardly available.

This poses a considerable barrier to beginners, where the workflow calls for frequent adaptions and fast modification and iteration.

We addressed this challenge, especially since our workflow for research into knitted sensors within the project TextileUX was in the same manner largely different from the requirements of the traditional textile industry. We therefore came up with an optimized process, which enabled us to operate more quickly.

With our background in Computer Science, we realized the potential to automatically generate large parts of our knitting programs using custom scripts. Hence, we created our JavsScript/NodeJS-based package Knitting Utils, which utilizes the CMU Textile Lab’s knitting program description language Knitout, which is a human-readable low-level language for specifying platform-independent knitting programs. Our Knitting Utils package builds upon the JavaScript Frontend for Knitout and enables to create otherwise highly complex knits with just a few lines of Java Script, by specifying patterns and source materials (i.e., yarn carriers) on course-level. While the low-level Knitout Frontend for JavaScript requires the user to keep track of many machine-state details and to program repetitive parts, Knitting Utils takes care of those in the background. Examples are current yarn carrier positions and states, respective knitting directions, automatic cutting of yarn that is no longer in use, automatic cast-on, cast-off, and loop drops, etc., as well as text-based pattern previews and warnings regarding potential flaws in the knit. Details about usage as well as some basic samples can be found on our Github repository. Complex knitting programs can be easily created, e.g., by using image files as template input, or by utilizing custom algorithms generate structures. This also enables the user to re-generate knit programs with slightly customized structures and element parameters, or to automatically batch-generate several variations of a design. All of those are highly complex, tedious, and time-consuming to do manually with traditional knitting software. By building our library on-top of Knitout, we harness its platform-independence and utilize pre-existing tools for visualization, debugging, and transpiling to different platforms.

Furthermore, since we prefer to use the open-source Microsoft VS Code editor for scripting and editing both JavaScript and Knitout, we maintain a plugin for VS Knitout language support, also on another Github repository. The plugin provides Knitout language syntax highlighting, which greatly improves readability of Knitout files.

Ressources: