Craft Yarn Color Run Consumption

Aggregate yarn consumption per explicit color run and supplied stitch allowance; no inferred pattern, tension or authoritative yarn requirement.

Description

Aggregate yarn consumption per explicit color run and supplied stitch allowance; no inferred pattern, tension or authoritative yarn requirement.

Yarn-length estimates can be accumulated by color when each stitch run has a measured or chosen length per stitch.

When to use this tool

Aggregate yarn consumption per explicit color run and supplied stitch allowance; no inferred pattern, tension or authoritative yarn requirement.

  • Prepare the supplied runsJson fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter runsJson. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.colors. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Parse runsJson records with color, nonnegative integer stitches and positive lengthPerStitch. Group exact color strings and sum stitches times lengthPerStitch.1

Input fieldMeaning and representationAccepted input
runsJsonJSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file.Text

For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.

json
[
  {
    "field": "runsJson",
    "decoded": [
      {
        "color": "red",
        "stitches": 3,
        "lengthPerStitch": 2
      },
      {
        "color": "red",
        "stitches": 1,
        "lengthPerStitch": 4
      }
    ]
  }
]
Output fieldInterpretation
resultObject containing the named outputs below.
result.colorsThe colors list in the ordering and representation described above.
json
{
  "input": {
    "runsJson": "[{\"color\":\"red\",\"stitches\":3,\"lengthPerStitch\":2},{\"color\":\"red\",\"stitches\":1,\"lengthPerStitch\":4}]"
  },
  "output": {
    "result": {
      "colors": [
        {
          "color": "red",
          "length": 10
        }
      ]
    }
  }
}

Limitations and assumptions

  • The length unit follows the supplied rate. Tails, tension variation, knots, waste and actual yarn measurement are not added.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Use the printer, material or pattern specification to choose allowances and rates. These tools perform the stated dimensional and count arithmetic, without measuring artwork or simulating production.

References

  1. Tool behavior and example: Craft Yarn Color Run Consumption — tool.io

Similar or alternative tools

  • Craft Bead String Length

    Budget craft bead string length from individually supplied bead diameters, inter-bead gaps and total end allowance; no elastic or knot model.

  • Craft Circle Stitch Angular Pitch

    Compute equal angular pitch for an explicit circular stitch count; does not estimate circumference or fabric deformation.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies