Monday, June 7, 2010

Using the KnitFitter

If you're following my top-down design tutorial (see sidebar), you can use my open source KnitFitter program to do the math and write the knitting instructions for you.

The KnitFitter is a Python program. It takes an input file containing the following sweater fields and outputs the instruction for knitting the sweater. To run the KnitFitter program with the input file Mysweater.txt, type the following at a command prompt:

python Mysweater.txt

The input file contains parameters to specify the design and size of the sweater. Each parameter is specified by a keyword followed by a colon(:) followed by the value of the parameter. If you do not specify a parameter in the input file, the KnitFitter will use a default value.

The current input parameters are:

Patternname: {Name of Pattern}

The Pattername parameter is just a name for this particular sweater. It can be any string.

Sweatertype: [raglan, poncho, round yoke, saddle shoulder, standard]

The Sweatertype specifies the basic construction type of the sweater. It can be one of raglan, poncho, round yoke, saddle shoulder, or standard. The The default is a raglan sweater.

Style: [cardigan, pullover]

The style indicates whether the sweater opens in front or not. It can be either cardigan or pullover. The default is a pullover sweater.

Neckline: [crew, scoop, vee, shawl]

The Neckline specifies the type of neckline for the sweater. It can be one of crew, scoop, vee, or shawl. The default for poncho sweaters is a vee; the default for all other sweater types is a crew neck.

Neckdepth: {Neck depth}

The neck depth indicates the depth, in inches, of the front neck. This applies only to vee and scoop necks.

Sleeves: [none, tapered, rectangular, bell, puffed]

The Sleeves can be none, tapered, rectangular, bell or puffed. Currently, only tapered sleeves are implemented. Short sleeves can be specified by modifying the Sleevelength parameter in the sizing portion of the input file.

Mainstripe: {Main stripe}
Accentstripe: {Accent stripe}

Mainstripe and Accentstripe apply to poncho sweaters only. They indicate the length, in rounds, of the main and accent stripes on the sweater. When these numbers are specified, the KnitFitter uses them to fill in the back neck with an even stripe pattern.

Stitchgauge: {Stitch gauge}
Rowgauge: {Row gauge}
Diagonalgauge: {Diagonal gauge}

These three parameter specify the gauge at which the garment will be knit. The first two are the standard stitches and rows per inch from the knitter's gauge swatch. The Diagonalgauge is used only for poncho sweaters. It's needed because poncho sweaters are knit on the bias.

Sizingclass: [Men's, Women's, Child's]

The Sizingclass indicates which sizing table the KnitFitter should use to find standard sizes. The default is Women's.

Size: {Size}

The Size indicates which standard size to use. Children's sizes are 6 months, 1, 2, 3, 4, 5, 6, 8, 10, and 12. Women's sizes are even sizes based on chest measurements, 30-50. Men's sizes are even sizes based on chest measurements, 34-50. If you specify a standard size, all measurements are taken from the standard size chart.

The remaining parameters all specify custom sizing. They are only processed if the input file does not include a standard size. All measurements are in inches. The custom sizing parameters are as follows (shown here with their default values):

Backneck: 5
Underarmdepth: 10
Upperchest: 15
Chest: 40
Chestdepth: 3
Bodylength: 20
Sleevelength: 18
Upperarm: 16
Wrist: 8
Shoulder: 4
Sleevecap: 4


Jeanine said...

Heather, it's so nice to bump into you again. I belonged to the homeschooling group years ago and even when we stopped homeschooling our son, I stayed with the group. Joshua and Iris-Matisse had similar problems learning to read and I followed her journey with interest and hope. Now he's 18 and about, perhaps, to graduate from high school and I'm an obsessed knitter. I hope your family are all well.

Dawn said...

I found your awesome site tonight. Can you give directions on converting patterns to top down in the round? This is my favorite way to knit sweaters. I just don't know how to covert sweaters from the bottom up or the ones that are knit in pieces. My email in Looking forward to hearing from you.
Dawn in NC

Anonymous said...

Having trouble running KnitFitter. Once I eliminated cockpit error I'm left with this:
dee@SPIKE:~/Knitting/KnitFitter$ python3 FirstTestSweater.txt >>testSweater.txt
Traceback (most recent call last):
File "", line 952, in
figureSweater(Mysweater, Mysize)
File "", line 431, in figureSweater
backstitches = int((size.backneck * sweater.stitchgauge) + (2 * (size.shoulder * sweater.stitchgauge)))
AttributeError: 'RaglanSize' object has no attribute 'shoulder'

As this seems to be a seldom-examined blog, I'll investigate -- but I think your instructions need to be a bit more complete.


Anonymous said...

Similar to Anonymous above, I'm having a problem with KnitFitter. I have also tried to eliminate pilot error, but get a different error message. I'm running Python 2.7.2+ on ubuntu oneiric (11.10).

omashu:~/projects$ python MySweater.txt
File "", line 778
print("on the sleeve sides of all four sleeve markers every even ", worktype, " and on", sep = "")
SyntaxError: invalid syntax

Anonymous #2

Heather Madrone said...

The KnitFitter requires Python 3.x. There are significant changes that means that Python programs are not backwards compatible.