Skip to content

Commit 9cda285

Browse files
authored
Merge pull request #120 from EmbroidePy/master
import changes
2 parents 36c25da + e23708f commit 9cda285

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pyembroidery/EmbPattern.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def insert_stitch_relative(self, position, cmd, dx=0, dy=0):
523523
if position < 0:
524524
position += len(self.stitches) # I need positive positions.
525525
if position == 0:
526-
self.stitches.insert(0, [dx, dy, TRIM]) # started (0,0)
526+
self.stitches.insert(0, [dx, dy, cmd]) # started (0,0)
527527
elif (
528528
position == len(self.stitches) or position is None
529529
): # This is properly just an add.
@@ -532,7 +532,7 @@ def insert_stitch_relative(self, position, cmd, dx=0, dy=0):
532532
p = self.stitches[position - 1]
533533
x = p[0] + dx
534534
y = p[1] + dy
535-
self.stitches.insert(position, [x, y, TRIM])
535+
self.stitches.insert(position, [x, y, cmd])
536536

537537
def insert(self, position, cmd, x=0, y=0):
538538
"""Insert a stitch or command"""

pyembroidery/PecWriter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def write_pec_header(pattern, f, threadlist):
6060
f.write(b"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20")
6161
add_value = current_thread_count - 1
6262
color_index_list.insert(0, add_value)
63+
assert color_index_list[0]<255, 'to many color changes, ({0}) out of bounds (0, 255)'.format(len(color_index_list))
6364
f.write(bytes(bytearray(color_index_list)))
6465
else:
6566
f.write(b"\x20\x20\x20\x20\x64\x20\x00\x20\x00\x20\x20\x20\xFF")

0 commit comments

Comments
 (0)