# KnitScript
## Set Up
Install Development Version (from local source code)
```
$ git clone https://github.khoury.northeastern.edu/mhofmann/KnitScript.git
$ pip install -e KnitScript
```
This will clone the repository to your machine and then install the system for active development to your python
interpreter associated with pip. This will give you access to KnitScript from anywhere on your machine as other
standard python libraries.
### Using knitscript from command line (Unix) # todo, untested
```
$knitscript -k <name for knitout to generate> -d <name for dat file to generate, optional> <name of knitscript file>
```
For example, when in the directory of tests\calibration samples we can generate a stockinette dat file by running
```
$ knitscript -k stst_knitout.k -d stst_dat.dat stst.ks
```
### Using knitscript from command line (windows)
Index into the KnitScript directory to access knitscript.bat or add knitscript.bat to your system PATH
```
$knitscript.bat -k <name for knitout to generate> -d <name for dat file to generate, optional> <name of knitscript file>
```
For example, when in the directory of tests\calibration samples we can generate a stockinette dat file by running
```
$ knitscript.bat -k stst_knitout.k -d stst_dat.dat stst.ks
```
### Using KnitScript Interpreter from Python
To just generate a knitout file from KnitScript, use the following
```python
from KnitScript.interpret import knit_script_to_knitout
knit_graph = knit_script_to_knitout('<pattern file>', '<knitout file name>')
```
To also generate a data file use:
```python
from KnitScript.interpret import knitscript_to_knitout_to_dat
knit_graph = knitscript_to_knitout_to_dat('<pattern file>', '<knitout file name>', '<dat file name>')
```
Additional examples of accessing the interpreter can be seen in the Test Cases
### Dat Compiler:
To work with a Shima Seiki Knitting machine you will need code to convert your knitout (.k) files into DAT (.dat)
files. The DAT compiler we use for testing our samples is closed-source and not included in this project. You will
need to bring your own to work with these machines. Install the compiler as a single javascript file called
"knitout_to_dat.js" in the knit_script_interpreter package. The Setup.py file will load this into your python
distribution.
### Kniterate Compiler:
We have not tested these samples on a kniterate machine however the knitout to [kniterate compiler](https://github.com/textiles-lab/knitout-backend-kniterate/) is available and
should work with our standardized knitout files.
## Packages
### knit_graphs
The knit_graphs package holds the components of a Knit_Graph representation of a knitted structure. Knit Graphs are
collections of loops connected on yarns and pulled through each other to form a node-link graph structure. Networkx
graphs are used to represent yarns and knit graphs. This provides a variety of common graph algorithms for
manipulating and searching in a knit graph. For more details on Loop based knit graphs reference [KnitPick](https://dl.acm.org/doi/abs/10.1145/3332165.3347886)
### knitting_machine
The knitting_machine package holds components of the machine state for a v-bed knitting machine. Knitout operations
can be performed on this virtual machine set which will either produce a knit graph representing the knitted object
or result in machine knitting errors. For more details on the basic representations of a knitting machine reference
[a compiler for Machine Knitting](https://dl.acm.org/doi/10.1145/2897824.2925940). For more details on knitout
operations reference the [knitout specification](https://textiles-lab.github.io/knitout/knitout.html).
### interpreter
The knit script interpreter which manages parsing and interpreting knitscript patterns. Parsing is managed through
the [Parglare parsing toolkit](http://www.igordejanovic.net/parglare/0.16.0/).
### tests
Test classes for evaluating the interpreter and parsing knitscript samples. Calibration samples are used for
calibrating allowable gauge on a machine. Paper samples demonstrate different basic techniques of sheet knittting.
Raw data
{
"_id": null,
"home_page": "https://github.khoury.northeastern.edu/mhofmann/KnitScript",
"name": "KnitScript",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Megan Hofmann",
"author_email": "m.hofmann@northeastern.edu",
"download_url": "https://files.pythonhosted.org/packages/83/76/5a232d7748c4f63ddbc17e032c3b9b951b7c36166e4ffcf00770da41bfd7/KnitScript-0.1.tar.gz",
"platform": null,
"description": "# KnitScript\r\n\r\n## Set Up\r\nInstall Development Version (from local source code)\r\n```\r\n$ git clone https://github.khoury.northeastern.edu/mhofmann/KnitScript.git\r\n$ pip install -e KnitScript \r\n```\r\nThis will clone the repository to your machine and then install the system for active development to your python \r\ninterpreter associated with pip. This will give you access to KnitScript from anywhere on your machine as other \r\nstandard python libraries.\r\n\r\n### Using knitscript from command line (Unix) # todo, untested\r\n```\r\n$knitscript -k <name for knitout to generate> -d <name for dat file to generate, optional> <name of knitscript file>\r\n```\r\nFor example, when in the directory of tests\\calibration samples we can generate a stockinette dat file by running\r\n```\r\n$ knitscript -k stst_knitout.k -d stst_dat.dat stst.ks\r\n```\r\n\r\n### Using knitscript from command line (windows)\r\nIndex into the KnitScript directory to access knitscript.bat or add knitscript.bat to your system PATH\r\n```\r\n$knitscript.bat -k <name for knitout to generate> -d <name for dat file to generate, optional> <name of knitscript file>\r\n```\r\nFor example, when in the directory of tests\\calibration samples we can generate a stockinette dat file by running\r\n```\r\n$ knitscript.bat -k stst_knitout.k -d stst_dat.dat stst.ks\r\n```\r\n\r\n### Using KnitScript Interpreter from Python\r\nTo just generate a knitout file from KnitScript, use the following\r\n```python\r\nfrom KnitScript.interpret import knit_script_to_knitout\r\nknit_graph = knit_script_to_knitout('<pattern file>', '<knitout file name>')\r\n```\r\n\r\nTo also generate a data file use:\r\n```python\r\nfrom KnitScript.interpret import knitscript_to_knitout_to_dat\r\nknit_graph = knitscript_to_knitout_to_dat('<pattern file>', '<knitout file name>', '<dat file name>')\r\n```\r\n\r\nAdditional examples of accessing the interpreter can be seen in the Test Cases\r\n\r\n### Dat Compiler:\r\nTo work with a Shima Seiki Knitting machine you will need code to convert your knitout (.k) files into DAT (.dat) \r\nfiles. The DAT compiler we use for testing our samples is closed-source and not included in this project. You will \r\nneed to bring your own to work with these machines. Install the compiler as a single javascript file called \r\n\"knitout_to_dat.js\" in the knit_script_interpreter package. The Setup.py file will load this into your python \r\ndistribution. \r\n\r\n### Kniterate Compiler:\r\nWe have not tested these samples on a kniterate machine however the knitout to [kniterate compiler](https://github.com/textiles-lab/knitout-backend-kniterate/) is available and \r\nshould work with our standardized knitout files. \r\n\r\n## Packages\r\n\r\n### knit_graphs\r\nThe knit_graphs package holds the components of a Knit_Graph representation of a knitted structure. Knit Graphs are \r\ncollections of loops connected on yarns and pulled through each other to form a node-link graph structure. Networkx \r\ngraphs are used to represent yarns and knit graphs. This provides a variety of common graph algorithms for \r\nmanipulating and searching in a knit graph. For more details on Loop based knit graphs reference [KnitPick](https://dl.acm.org/doi/abs/10.1145/3332165.3347886)\r\n\r\n### knitting_machine\r\nThe knitting_machine package holds components of the machine state for a v-bed knitting machine. Knitout operations \r\ncan be performed on this virtual machine set which will either produce a knit graph representing the knitted object \r\nor result in machine knitting errors. For more details on the basic representations of a knitting machine reference \r\n[a compiler for Machine Knitting](https://dl.acm.org/doi/10.1145/2897824.2925940). For more details on knitout \r\noperations reference the [knitout specification](https://textiles-lab.github.io/knitout/knitout.html).\r\n\r\n### interpreter\r\nThe knit script interpreter which manages parsing and interpreting knitscript patterns. Parsing is managed through \r\nthe [Parglare parsing toolkit](http://www.igordejanovic.net/parglare/0.16.0/).\r\n\r\n### tests\r\nTest classes for evaluating the interpreter and parsing knitscript samples. Calibration samples are used for \r\ncalibrating allowable gauge on a machine. Paper samples demonstrate different basic techniques of sheet knittting. \r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Interpreter from KnitScript to Knitout Instructions",
"version": "0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d9fa45bf15e481659d83bdf3de45ea72",
"sha256": "2649d1f553394a464fd2f5c8ae29a0571994f4ebac24d09ba37b90420466d965"
},
"downloads": -1,
"filename": "KnitScript-0.1.tar.gz",
"has_sig": false,
"md5_digest": "d9fa45bf15e481659d83bdf3de45ea72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 59240,
"upload_time": "2022-12-12T18:05:00",
"upload_time_iso_8601": "2022-12-12T18:05:00.110933Z",
"url": "https://files.pythonhosted.org/packages/83/76/5a232d7748c4f63ddbc17e032c3b9b951b7c36166e4ffcf00770da41bfd7/KnitScript-0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-12 18:05:00",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "knitscript"
}