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_pyembroidery_of(stitch_group_idx)[source]¶
Get the PyEmbroidery pattern with the stitch commands of the i-th stitch group
- get_stitch_command() list[tuple[float, float, Literal[0, 1, 2, 3, 4, 5, 6]]][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.
- class turtlethread.stitches.StitchGroup(start_pos: Vec2D, color: str)[source]¶
-
- 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, 3, 4, 5, 6]]][source]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- speedup = 0¶
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.
- class turtlethread.stitches.DirectStitch(start_pos: Vec2D, color: str)[source]¶
A minimal stitch just to run thread from one point to another.
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- speedup = 0¶
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.
- class turtlethread.stitches.RunningStitch(start_pos: Vec2D, color: str, 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 between0.5*stitch_lengthand1.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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- speedup = 0¶
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.
- class turtlethread.stitches.JumpStitch(start_pos: Vec2D, color: str = None, 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
StitchGroupfor 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- speedup = 0¶
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.
- class turtlethread.stitches.UnitStitch(start_pos: Vec2D, color: str, stitch_length: int | float, auto_adjust: bool = True, enforce_end_stitch: bool = True, enforce_start_stitch: bool = True)[source]¶
Class to represent stitches that are built off repeating a single pattern, e.g. zigzag, cross stitches.
Given the distance to travel, the stitch will be repeated the required number of times to reach that distance.
Contains a starting stitch and an ending stitch function. These functions will be called once at the start and end of the overall stitch, respectively. This is useful, for example, for centering stitches.
Parameters¶
- stitch_lengthint
Number of steps between each unit stitch, in the direction of travel. If auto-adjustment is not enabled, this will be the exact number of steps between each unit stitch.
- auto_adjustbool (optional, default=True)
If True, the stitch length will be automatically adjusted to a multiple of the distance travelled. Useful when only drawing a single forward or backwards stitch. If False, the stitch length will be exactly
stitch_length. A final stitch will be added to the end position unless enforce_end_position is False.- enforce_end_stitchbool (optional, default=True)
If True, the final stitch must be positioned at the end position. This will ensure that the total length of the stitch is the total distance to be traveled. If False, there is no such guarantee. Any ending stitch will not occur. Useful in conjunction with enforce_start_stitch, to seamlessly blend two stitches together.
- enforce_start_stitchbool (optional, default=True)
If True, the first stitch must be positioned at the start position. If False, the starting stitch pattern will not occur.
Internal Attributes¶
- stitch_stop_multiplierfloat (default=0)
When stitching, the unit stitch will be repeated until there is stitch_stop_multiplier * stitch_length left to stitch. Useful when implementing an ending stitch pattern.
- xint | float
The current x position of the turtle. Used for _start_stitch_unit and _end_stitch_unit.
- yint | float
The current y position of the turtle. Used for _start_stitch_unit and _end_stitch_unit.
- distance_traveledint | float
The distance travelled by the turtle. Used for _start_stitch_unit and _end_stitch_unit.
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- classmethod round_stitch_length(stitch_length: int | float, distance: int | float)[source]¶
Method to round the stitch length to a multiple of the distance.
Parameters¶
- stitch_lengthint | float
The stitch length to round.
- distanceint | float
The distance of travel.
- speedup = 0¶
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.
- class turtlethread.stitches.ZigzagStitch(start_pos: Vec2D, color: str, stitch_length: int | float, stitch_width: int | float, center: bool = False, auto_adjust: bool = True, enforce_end_stitch: bool = True, enforce_start_stitch: bool = True)[source]¶
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- classmethod round_stitch_length(stitch_length: int | float, distance: int | float)¶
Method to round the stitch length to a multiple of the distance.
Parameters¶
- stitch_lengthint | float
The stitch length to round.
- distanceint | float
The distance of travel.
- speedup = 0¶
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.
- class turtlethread.stitches.SatinStitch(start_pos: Vec2D, color: str, stitch_width: int | float, center: bool = True)[source]¶
Stitch group for satin stitches. A satin stitch is simply a zigzag stitch with a tight density. This creates a solid fill. We use 0.3mm for the density.
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- classmethod round_stitch_length(stitch_length: int | float, distance: int | float)¶
Method to round the stitch length to a multiple of the distance.
Parameters¶
- stitch_lengthint | float
The stitch length to round.
- distanceint | float
The distance of travel.
- speedup = 1¶
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.
- class turtlethread.stitches.CrossStitch(start_pos: Vec2D, color: str, stitch_length: int | float, stitch_width: int | float, center: bool = False, auto_adjust: bool = True, enforce_end_stitch: bool = True, enforce_start_stitch: bool = True)[source]¶
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- classmethod round_stitch_length(stitch_length: int | float, distance: int | float)¶
Method to round the stitch length to a multiple of the distance.
Parameters¶
- stitch_lengthint | float
The stitch length to round.
- distanceint | float
The distance of travel.
- speedup = 0¶
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.
- class turtlethread.stitches.ZStitch(start_pos: Vec2D, color: str, stitch_length: int | float, stitch_width: int | float, center: bool = False, auto_adjust: bool = True, enforce_end_stitch: bool = True, enforce_start_stitch: bool = True)[source]¶
- 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, 3, 4, 5, 6]]]¶
Get the list of PyEmbroidery stitch commands for this stitch group
- classmethod round_stitch_length(stitch_length: int | float, distance: int | float)¶
Method to round the stitch length to a multiple of the distance.
Parameters¶
- stitch_lengthint | float
The stitch length to round.
- distanceint | float
The distance of travel.
- speedup = 0¶
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.