Skip to main content

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.

Release files for knit-graphs 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for knit-graphs 0.1.4
File Size Uploaded
knit_graphs-0.1.4.tar.gz 44.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for knit-graphs 0.1.4
File Interpreter ABI Platform
knit_graphs-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 103.7 kB

Release files / knit_graphs-0.1.4.tar.gz

Download URL knit_graphs-0.1.4.tar.gz
Size 44.0 kB
Tags Source
SHA-256 checksum
How to use checksums
69d1712ad0ed237a8eecdb507b83d55139a16a95104726fc76a413cc49152916
BLAKE2b-256 checksum
How to use checksums
683b8dd871aff555254fe0bec94680f412b41fc0396a76e4d406b78adbc016dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.15 Linux/6.17.0-1008-azure

Release files / knit_graphs-0.1.4-py3-none-any.whl

Download URL knit_graphs-0.1.4-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5225871d7a98faceb6ad9292361e53ee303093d6999181d5e6a5976ee3fe76b
BLAKE2b-256 checksum
How to use checksums
482e79c7506a4587fff61c155e8724231114bb541c9541ac0d9f2b76e039bb32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.15 Linux/6.17.0-1008-azure

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page