CreativeInquiry / PEmbroider

Embroidery Library for Processing
Other
443 stars 28 forks source link

layer offset in multicolor example #83

Closed stephanschulz closed 3 years ago

stephanschulz commented 3 years ago

I have run the PEmbroider_png_image_multicolor example and my resulting .jef file has all layers offset without any specific logic to it. I tried to counter the offset but was not able to find the correct values.

Screen Shot 2020-08-01 at 5 36 05 PM

so I use a very simple sketch and noticed that when setting fill() to an RGB value things screw up but with fill(0,0,0) for all layer everything is ok.

fill_black fill_RGB

I use this web app to look at my .jef files https://htmtopdf.herokuapp.com/embroidery/

Here my test code: https://gist.github.com/stephanschulz/134cca94208a48b43032d49e08228642

golanlevin commented 3 years ago

@stephanschulz thanks so much for diagnosing this. @tatyanade designed and executed this pattern on our lab's Viking, and we didn't have this offset issue. I wonder if it might be something with the Janome .JEF format in particular. @LingDong-, we might need to do some byte-level scrutiny :( to find the problem ...

LingDong- commented 3 years ago
Screen Shot 2020-08-04 at 8 34 44 PM

Great news @golanlevin @stephanschulz , I can reproduce the issue! Wow really messed up offsets! will fix.

stephanschulz commented 3 years ago

Happy to hear that. What tool are you using here to view the .jef file?

LingDong- commented 3 years ago

Haha! fixed in one line: eef1f06cb380e7e45bb87af0ad20cb26eb57e5e7

Screen Shot 2020-08-04 at 8 41 17 PM

The issue is that JEF cannot encode stitches longer than [-128,127] units (yup they store it in an int8), the original solution I had was to break long stitches to smaller ones of the length 128. Which is 1 unit over 127, so it still fails! Now modified the cap to 100 to play it safe.

EDIT: I'm using Premier+2 http://www.husqvarnaviking.com/en-US/Software/Premier-2 @stephanschulz

stephanschulz commented 3 years ago

@LingDong- do you think you can create a new zip to download the library? I believe your fixes are only in the source code but not yet in the available pre-build .zip

thx a bunch

LingDong- commented 3 years ago

Hi @stephanschulz , I believe it is already in the distribution:

image

The distribution is updated automatically every time I make a change to the source and compile it. Did it not work for you?

stephanschulz commented 3 years ago

Yes I still get miss alignments. Attached a screenshot of the online .jef viewer, the png output of P5 and the output .jef file

Screen Shot 2020-08-10 at 5 57 51 PM

Jean moulin_2020_8_10_16_47_59

Jean moulin_2020_8_10_16_47_59.jef.zip

LingDong- commented 3 years ago

Strange enough, the pictures look alright in my viewers:

Screen Shot 2020-08-10 at 6 02 15 PM Screen Shot 2020-08-10 at 6 02 48 PM
stephanschulz commented 3 years ago

Also the latest .zip does not have your PEmbroider_trace_skeleton example in it. So something must be not working with the automatic distribution updating.

stephanschulz commented 3 years ago

Strange enough, the pictures look alright in my viewers:

Screen Shot 2020-08-10 at 6 02 15 PM Screen Shot 2020-08-10 at 6 02 48 PM

did you try https://htmtopdf.herokuapp.com/embroidery/ to view my and your jef files? I do not have Premier+ to check

LingDong- commented 3 years ago

Snip20200810_49

Tried in Embird too, it works too.

LingDong- commented 3 years ago

Premier+ is free for mac and PC http://www.husqvarnaviking.com/en-US/Support/Complimentary-Software

LingDong- commented 3 years ago

PEmbroider_trace_skeleton is not in it because it's not part of the source code: The distribution is rebuilt every time there's a modification to the source, the JEF fix is a modification to the source so that one should be in it I think...

stephanschulz commented 3 years ago

I will try Premier+ and also just run the .jef on my machine. I assumed because the online viewer shows a misalignment it will also do it on the machine. Will report back in 10 minutes.

LingDong- commented 3 years ago

I can confirm that herokuapp viewer shows the wrong offsets, though I'm not sure which software(s) is correct (Currently the score is 2:1). I think in the end the hardware has the final say :P Have you tried it on the real machine?

stephanschulz commented 3 years ago

I guess the online viewer has a hard time handling either all multi color .jef files, or just ours. Anyway the final stitch looks fine. Here I am just using one color to save time. 2020-08-10 18 18 50