Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PES to SEW conversion not working #190

Open
BartmanEH opened this issue Jan 25, 2022 · 32 comments
Open

PES to SEW conversion not working #190

BartmanEH opened this issue Jan 25, 2022 · 32 comments

Comments

@BartmanEH
Copy link

fresh build of libembroiderery on mac 12.1 but conversion from PES to SEW produces invalid results

@robin-swift
Copy link
Member

Ok, can you show me the terminal output from the conversion?

Let's work this out.

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

%./libembroidery/embroider test.pes test.sew                                                       
test.pes

maybe I'm missing -t sew?

@robin-swift
Copy link
Member

No that should work. What's the file size of the output?

@robin-swift robin-swift self-assigned this Jan 25, 2022
@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

22KB (input PES is 117KB)

@robin-swift
Copy link
Member

Does the sew file not load at all? Or is it incomplete?

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

using StitchBuddy, the PES previews fine but the SEW is blank. Trying to open it in StitchBuddy yields:
Screen Shot 2022-01-25 at 4 20 02 PM

@robin-swift
Copy link
Member

Ah, that's the error message I need. Can you paste the output of:

% xxd test.sew | head

I.e. the first 256bytes in hex format.

@BartmanEH
Copy link
Author

00000000: 6004 0000 0a00 0000 1d00 0000 2900 0000  `...........)...
00000010: 0100 0000 3a00 0000 1d00 0000 2900 0000  ....:.......)...
00000020: 0100 0000 4200 0000 1d00 0000 1e00 0000  ....B...........
00000030: 0100 0000 0c00 0000 1d00 0000 1e00 0000  ................
00000040: 0100 0000 4200 0000 1d00 0000 1e00 0000  ....B...........
00000050: 0100 0000 0100 0000 0100 0000 3200 0000  ............2...
00000060: 0100 0000 0100 0000 0100 0000 3200 0000  ............2...
00000070: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...
00000080: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...
00000090: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...

@BartmanEH
Copy link
Author

I tried DST conversion but it doesn't work either and I get a lot of screen output:

 libembroidery % ./embroider test.pes test.dst
test.pes
0 90.933333 19.111111 909 191 909 191
ERROR: format-t01.c encode_record(), x is not in valid range [-121,121] , x = 909
1 79.566667 16.722222 -113 -24 796 167
2 68.200000 14.333333 -114 -24 682 143
3 56.833333 11.944444 -114 -24 568 119
4 45.466667 9.555556 -113 -23 455 96
5 34.100000 7.166667 -114 -24 341 72
6 22.733333 4.777778 -114 -24 227 48
7 11.366667 2.388889 -113 -24 114 24
8 102.300000 21.500000 909 191 1023 215
ERROR: format-t01.c encode_record(), x is not in valid range [-121,121] , x = 909

[truncated]

@robin-swift
Copy link
Member

Yeah, that's big jumps not being split properly. I know about that bug.

If you hang on 5 minutes I may work out what this colour change bug is.

@robin-swift
Copy link
Member

Can you paste the output of

% ./libembroidery/embroider test.pes test.csv
% head test.csv

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

% head test.csv      
"#","Embroidermodder 2 CSV Embroidery File"
"#","http://embroidermodder.github.io"

"#","General Notes:"
"#","This file can be read by Excel or LibreOffice as CSV (Comma Separated Value) or with a text editor."
"#","Lines beginning with # are comments."
"#","Lines beginning with > are variables: [VAR_NAME], [VAR_VALUE]"
"#","Lines beginning with $ are threads: [THREAD_NUMBER], [RED], [GREEN], [BLUE], [DESCRIPTION], [CATALOG_NUMBER]"
"#","Lines beginning with * are stitch entries: [STITCH_TYPE], [X], [Y]"

@robin-swift
Copy link
Member

So what I want to see is slightly below that:

% head -n40 test.csv

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

% head -n40 test.csv
"#","Embroidermodder 2 CSV Embroidery File"
"#","http://embroidermodder.github.io"

"#","General Notes:"
"#","This file can be read by Excel or LibreOffice as CSV (Comma Separated Value) or with a text editor."
"#","Lines beginning with # are comments."
"#","Lines beginning with > are variables: [VAR_NAME], [VAR_VALUE]"
"#","Lines beginning with $ are threads: [THREAD_NUMBER], [RED], [GREEN], [BLUE], [DESCRIPTION], [CATALOG_NUMBER]"
"#","Lines beginning with * are stitch entries: [STITCH_TYPE], [X], [Y]"

"#","Stitch Entry Notes:"
"#","STITCH instructs the machine to move to the position [X][Y] and then make a stitch."
"#","JUMP instructs the machine to move to the position [X][Y] without making a stitch."
"#","TRIM instructs the machine to cut the thread before moving to the position [X][Y] without making a stitch."
"#","COLOR instructs the machine to stop temporarily so that the user can change to a different color thread before resuming."
"#","END instructs the machine that the design is completed and there are no further instructions."
"#","UNKNOWN encompasses instructions that may not be supported currently."
"#","[X] and [Y] are absolute coordinates in millimeters (mm)."

"#","[VAR_NAME]","[VAR_VALUE]"
">","STITCH_COUNT:","3896"
">","THREAD_COUNT:","251"
">","EXTENTS_LEFT:","-3499.600000"
">","EXTENTS_TOP:","-2996.000000"
">","EXTENTS_RIGHT:","3458.800000"
">","EXTENTS_BOTTOM:","4564.200000"
">","EXTENTS_WIDTH:","6958.400000"
">","EXTENTS_HEIGHT:","7560.200000"

"#","[THREAD_NUMBER]","[RED]","[GREEN]","[BLUE]","[DESCRIPTION]","[CATALOG_NUMBER]"
"$","1","32","100","120","f. Unimplemented for now.","an the header."
"$","2","58","32","101","mb-polyline.c embArray_create(), ","memory for heapPolylineObj
"
"$","3","0","0","0","Unknown",""
"$","4","58","32","37","d
Name  : %s

","on  : %s
Description: %s
Reade"

@robin-swift
Copy link
Member

Oh dear, that's a new one. I've not cleared out the memory for the strings so it's got whatever rubbish is there.

I'm writing a patch that should help with this testing and fix some minor bugs, hang on.

@robin-swift
Copy link
Member

Ok, git pull and rebuild with cmake --build ..

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

oh man... I'm not a dev, I'm a hack... this is gonna go horribly wrong :-)

EDIT: how do I git pull for just libembroidery?

@robin-swift
Copy link
Member

You've followed me to here I've not been confused by your replies at any point.

This is a good real world test of the software, so I'm enjoying it.

@robin-swift
Copy link
Member

You do git pull from inside the code directory.

So from where your terminal appears to be:

cd libembroidery
git pull

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

% ./libembroidery/embroider test.pes test.sew
test.pes
Debugging Information
number of colors = 251
number of stitches = 3896
Color: 0 1
Color: 1 1
Color: 2 1
Color: 3 1
Color: 4 1
Color: 5 1
Color: 6 1

[truncated]

same size SEW results file (22KB) and still 'blank' or invalid

@robin-swift
Copy link
Member

Huh, now that's surprising.

How similar to your design is

number of colors = 251
number of stitches = 3896

I doubt it really is a 251 thread color pattern.

@BartmanEH
Copy link
Author

lol, indeed not: 2 colors

@robin-swift
Copy link
Member

and how many stitches?

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

Screen Shot 2022-01-25 at 4 57 42 PM

According to StitchBuddy

@robin-swift
Copy link
Member

That's useful. I'm thinking...

@robin-swift
Copy link
Member

Ok, so can I see the same hexdump for your input?

xxd test.pes | head

@BartmanEH
Copy link
Author

% xxd test.pes | head
00000000: 2350 4553 3030 3031 802f 0100 0100 0100  #PES0001./......
00000010: 0100 ffff 0000 0700 4345 6d62 4f6e 6500  ........CEmbOne.
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0080 3f00 0000 0000 0000 0000 0080 3f00  ..?...........?.
00000040: d80e 4480 eba5 4401 0000 0000 0059 038e  ..D...D......Y..
00000050: 0200 0000 0000 0000 0062 00ff ff00 0007  .........b......
00000060: 0043 5365 7753 6567 0100 1d00 0200 ac01  .CSewSeg........
00000070: b9fe 0400 51ff 0380 0000 1d00 872c 0400  ....Q........,..
00000080: 51ff 0000 52ff 0400 51ff 0000 52ff 0400  Q...R...Q...R...
00000090: 51ff 0000 52ff 0a00 5cff 1500 67ff 2300  Q...R...\...g.#.

@robin-swift
Copy link
Member

Ok, so I think I can offer your workflow a solution quicker than fixing this. Then fix this at a later date.

Can you output from your design software in Tajima .dst? Then do the conversion to .sew.

@BartmanEH
Copy link
Author

OK, I'll try that but it will take me some time to wrestle Inkstitch into submission, again. Thanks for your support. I'll post my results here hopefully later tonight.

@robin-swift
Copy link
Member

I'll open an new issue... use #191

@JoshVarga
Copy link
Member

Based on the output you provided, SEW is really not outputting correctly. those first two bytes couldn't possibly be that large. I made a change to output the header with the correct values. That should get this MUCH closer to working... Maybe give it another shot.

00000000: 6004 0000 0a00 0000 1d00 0000 2900 0000  `...........)...
00000010: 0100 0000 3a00 0000 1d00 0000 2900 0000  ....:.......)...
00000020: 0100 0000 4200 0000 1d00 0000 1e00 0000  ....B...........
00000030: 0100 0000 0c00 0000 1d00 0000 1e00 0000  ................
00000040: 0100 0000 4200 0000 1d00 0000 1e00 0000  ....B...........
00000050: 0100 0000 0100 0000 0100 0000 3200 0000  ............2...
00000060: 0100 0000 0100 0000 0100 0000 3200 0000  ............2...
00000070: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...
00000080: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...
00000090: 0100 0000 3200 0000 1d00 0000 3200 0000  ....2.......2...

@BartmanEH
Copy link
Author

BartmanEH commented Jan 25, 2022

after a git pull and make:

% ./libembroidery/embroider test.pes test.sew
test.pes
Debugging Information
number of colors = 251
number of stitches = 3896

output is 21KB now but still not viable.

% xxd test.sew | head                        
00000000: fb00 0100 0100 0100 0100 0100 0100 0100  ................
00000010: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000020: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000030: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000040: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000050: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000060: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000070: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000080: 0100 0100 0100 0100 0100 0100 0100 0100  ................
00000090: 0100 0100 0100 0100 0100 0100 0100 0100  ................

@robin-swift robin-swift removed their assignment Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants