Support for interpreting knitout files used for controlling automatic V-Bed Knitting machines.
Project description
knitout_interpreter
Description
Support for interpreting knitout files used for controlling automatic V-Bed Knitting machines. This complies with the Knitout specification created by McCann et al.
Table of Contents
Installation
pip install knitout-interpreter
Usage
Run Knitout
To execute a knitout file (e.g., "example.k") on a virtual knitting machine, you can use the run_knitout function from the run_knitout Module. This will return a list of knitout-line objects in the order of execution, the virtual knitting machine created and after the knitout operations have completed, and the knitgraph that is rendered by these knitout operations.
from knitout_interpreter.run_knitout import run_knitout
knitout_lines, knitting_machine_state, knitted_knit_graph = run_knitout("example.k")
In addition to processing the knitout instructions into a list of instructions that executed on a virtual machine, this package supports interoperation with existing knitout compilers to Shima Seiki DAT files and Kniterate files.
To interpret and convert the knitout code to a DAT file, execute the following:
from knitout_interpreter.run_knitout import interpret_knitout
success= interpret_knitout("sample.k", "sample.dat")
The resulting DAT files can be viewed using the Dat Viewer Interface from the CMU Textiles Lab.
To generate Kniterate KCODE using the CMU Textiles Lab Kniterate compiler, modify the code as follows.
from knitout_interpreter.run_knitout import interpret_knitout
from knitout_interpreter.knitout_compilers.compile_knitout import Knitout_to_Machine_Compiler
success= interpret_knitout("sample.k", "sample.dat", Knitout_to_Machine_Compiler.Kniterate_Compiler)
Knitout Executer
The Knitout Execute Class provides additional support for analyzing an executed knitout program.
It provides the following functionality:
- Determining the execution time of a knitout program measured in carriage passes (not lines of knitout).
- Finding the left and right most needle indices that are used during execution. This can be used to determine the width needed on a knitting machine.
- Testing the knitout instructions against common knitting errors
- Reorganizing a knitout program into carriage passes (such as sorting xfers to be in carriage pass order) and writing these out to a new file.
License
knitout-interpreter
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file knitout_interpreter-0.0.12.tar.gz
.
File metadata
- Download URL: knitout_interpreter-0.0.12.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38d72ffd329a64bbf51f4bc43c3996d469d4e2a6d0bf65e1c28beefa003c23c3 |
|
MD5 | 06f4b8b4f56a2c564cd3651cafb39af0 |
|
BLAKE2b-256 | 27ae69597e1efc05d18c4709485438b6a937394b864a43e8c67d6d9720b845bc |
File details
Details for the file knitout_interpreter-0.0.12-py3-none-any.whl
.
File metadata
- Download URL: knitout_interpreter-0.0.12-py3-none-any.whl
- Upload date:
- Size: 69.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80752c544929c71ffd27876dc48add23d10c541fe8bce80370e5d9c4525d11e2 |
|
MD5 | 2dfbdc7e4e30c3a3d94690706debef99 |
|
BLAKE2b-256 | e00e5c50c5cd5a8b2917c6094172c5649af2db2466eebbb5d1c301e8849c5174 |