Patterns and stitch types#

class turtlethread.stitches.EmbroideryPattern(scale: int = 1)[source]#

Abstract representation of an embroidery pattern.

Container object

Parameters:
scale: int (optional, default=1)

All coordinates are multiplied by this parameter before converting it to a PyEmbroidery pattern. This is useful to control the number of steps per mm (default is 10 steps per mm).

get_stitch_command() list[tuple[float, float, Literal[0, 1, 2]]][source]#

Get stitch commands for PyEmbroidery.

This function is used when embroidery patterns contain whole embroidery patterns. If you’re not explicitly making patterns within patterns, then you probably want to use the to_pyembroidery() method instead.

to_pyembroidery() EmbPattern[source]#

Convert to a PyEmbroidery pattern.

class turtlethread.stitches.StitchGroup(start_pos: Vec2D)[source]#

Object representing one contiguous set of commands for the embroidery machine.

Stitch groups are used to convert the Turtle commands into embroidery machine commands. For example, if you want to embroider with a running stitch, then you’d create a stitch group for a running stitch with the corresponding stitch length.

Stitch groups work by storing subsequent locations of the Turtle and converts them into embroidery commands.

Parameters:
start_pos: Vec2D (tuple[float, float])

The initial position of the turtle.

add_location(location: Vec2D) None[source]#

Add a new location to this stitch group.

empty_copy(start_pos) Self[source]#

Create a copy of the stitch group but with no stored locations (i.e. no stitches).

get_stitch_commands() list[tuple[float, float, Literal[0, 1, 2]]][source]#

Get the list of PyEmbroidery stitch commands for this stitch group

class turtlethread.stitches.RunningStitch(start_pos: Vec2D, stitch_length: int | float)[source]#

Stitch group for running stitches.

With a running stitch, we get stitches with a constant distance between each stitch.

If the turtle is supposed to move a number of steps that is not a multiple of stitch_length, then all but the last stitch in that stretch will have the same length and the last stitch will be between 0.5*stitch_length and 1.5*stitch_length.

Parameters:
stitch_lengthint

Number of steps between each stitch.

add_location(location: Vec2D) None#

Add a new location to this stitch group.

empty_copy(start_pos) Self#

Create a copy of the stitch group but with no stored locations (i.e. no stitches).

get_stitch_commands() list[tuple[float, float, Literal[0, 1, 2]]]#

Get the list of PyEmbroidery stitch commands for this stitch group

class turtlethread.stitches.JumpStitch(start_pos: Vec2D, skip_intermediate_jumps: bool = True)[source]#

Stitch group for jump stitches.

A jump stitch group always starts with a trim command followed by the needle moving without sewing any stitches.

See StitchGroup for more information on stitch groups.

Parameters:
skip_intermediate_jumpsbool (optional, default=True)

If True, then multiple jump commands will be collapsed into one jump command. This is useful in the cases where there may be multiple subsequent jumps with no stitches inbetween. Multiple subsequent jumps doesn’t make sense but it can happen dependent on how you generate your patterns.

add_location(location: Vec2D) None#

Add a new location to this stitch group.

empty_copy(start_pos) Self#

Create a copy of the stitch group but with no stored locations (i.e. no stitches).

get_stitch_commands() list[tuple[float, float, Literal[0, 1, 2]]]#

Get the list of PyEmbroidery stitch commands for this stitch group