Skip to main content

A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.

Project description

knit_graphs

PyPI - Version PyPI - Python Version


Description

The knit-graphs packaged provides a data structure for representing knitted structures formed of loops of yarn (nodes) connected by various edge structures. Loops are connected by: floats (yarn-edges) in a yarn graph structure, stitch edges (loops pulled through loops), and crossed over each other in a wale-braid structure.

Knit graphs provide a powerful tool for representing knitted structures for digital fabrication systems such as knitting machine programming languages and design tools.

Additional details about this knit-graph construction are available in the ACM publication: "KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting"

Table of Contents

Installation

pip install knit-graphs

Usage

Knit Graph Generators

The knit-graph-generators subpackage provides a library of basic knit graphs to generate such as casting on loops of a knitted structure, creating Jersey (aka Stockinette) tubes and swatches, and other basic textures. For example, to generate a swatch of knit-purl ribbing use the following:

from knit_graphs.basic_knit_graph_generators import kp_rib_swatch

width = 10
height = 10
kp_rib_swatch = kp_rib_swatch(width, height)

Additional examples of knitgraph generator usage can be found in the Knit_Graph test module.

Knitgraphs can be created without generators. We encourage users to review the generators as simple examples on creating a knit graph programmatically.

Visualizing Knit Graphs

We provide simple support for visualizing knit graphs. This is primarily used to debugging simple knit graph programs.

For example, we can visualize a swatch of seed stitch (checkered knit and purl stitches) with the following code.

from knit_graphs.basic_knit_graph_generators import seed_swatch
from knit_graphs.knit_graph_visualizer.Stitch_Visualizer import visualize_stitches

width = 4
height = 4
swatch = seed_swatch(width, height)
visualize_stitches(swatch)

The visualizer shows knit stitches (loops pulled from the back of the fabric to the front) as blue edges and purl stitches (loops pulled from the front to back) (aka back-knits) as red edges. Loop nodes are circles labeled with their time-ordered index and colored to match their yarn (defaults to dark green). The yarn edges (aka floats) connecting them are made of thin edges the same color as the loop nodes.

Additional examples of using the visualizer are available in the Stitch Visualizer Tests Module

Credits

The design of this data scructure was completed by the authors of "KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting".

The inclusion of the Artin-Braide wale crossing construction was inspired by "An Artin Braid Group Representation of Knitting Machine State with Applications to Validation and Optimization of Fabrication Plans" by Jenny Lin and James McCann.

License

knit-graphs is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knit_graphs-0.1.0.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knit_graphs-0.1.0-py3-none-any.whl (57.1 kB view details)

Uploaded Python 3

File details

Details for the file knit_graphs-0.1.0.tar.gz.

File metadata

  • Download URL: knit_graphs-0.1.0.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for knit_graphs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28662bc3d9d81e5cd91d9288b47c4b540ca451a4d07d5c980297023a23ccc5fb
MD5 84f1d77c1b29185c5bde98fcd53f3e63
BLAKE2b-256 6dd76c2578a937d03d872de0341f3bfcab343a21ccaacb7c02cb0c3a9f212502

See more details on using hashes here.

File details

Details for the file knit_graphs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: knit_graphs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 57.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for knit_graphs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53cd0f8d0f93c44bc6e6af0e9b9512b64b8375ce7fe352b6987d9ce1ead11578
MD5 0e98836e9c45502e3e5e1fc9cef44d83
BLAKE2b-256 a422fbef3ef54ec861afa542b7763f032916dc4874c9054f1837f637144fb118

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page