Pages

Thursday 13 July 2017

Hidden Harbor

Waste knots are gone (of course), and starting on the first colour of this next section.



Since the HAED pattern symbols are just text (using a font made up of symbols), I can easily copy and paste right out of the PDF into a text file, and analyze that with my traveling salesman program. It's easy enough to copy each page one by one, but since I'm doing rows across pages for this one, I didn't want to take the time to copy the pages row by row into a text file.

So I wrote a quick PowerShell program to grab the rows from each page, and stick them together so that 
1
1
1
2
2
2
3
3
3
becomes
1 2 3
1 2 3
1 2 3
But then, I was having trouble with the next section, and the text wasn't combining properly in all of the output files. So I rewrote the script in C#, where I can throw different encodings at the files (I mean, you can probably do that in PowerShell too but I'm more comfortable in C#). Well, long story short, turns out I had encoded the first couple of input files in ANSI, and the rest in UTF8. So I redid the files, made sure that they were all encoded in the same way, and lo and behold the combining worked properly.

Here's an example output from the traveling salesman program btw (this is the current colour I'm working on up above):
It separates out all the stitches by colour, then plots a (close enough) optimal route through them.

I really need to get around to making the start and end stitch a different colour. Not that it's hard or time consuming, I just have to remember to do it when I'm at the computer and have time.

No comments:

Post a Comment