EmbroidePy / EmbroideryIO

Java/Android library for input/output of Embroidery file types.
MIT License
20 stars 4 forks source link

How to get the coordinates and type of embroidery #32

Open zeepLi123 opened 2 months ago

zeepLi123 commented 2 months ago

Hello, I am currently learning about the EmbroideryIO Java library to process DST and DSB files, but I cannot obtain the specific coordinates after analysis. May I ask where this coordinate can be obtained? I searched for very few tutorials on the Internet. Thank you very much for answering my questions in your free time. thank you.

tatarize commented 2 months ago

The general rule of thumb is that it's a list of coords and type of stitch. I think you can call getX(index) and getY(index) for each of the various indexes. Or call getPointList() to get the point values which are stored in floats and getData() which will give you the data value for the stitches as an integer.

zeepLi123 commented 2 months ago

Just now I tried the getPointlist() method, and then I called the getData() method. What was returned was not the coordinate point of the file. I want to try the first method to obtain it through getX(index) and getY(index), but I don't know how to obtain this index. Could you please tell me how to obtain this index?

tatarize commented 2 months ago

https://github.com/EmbroidePy/EmbroideryIO/commit/6711cd91192bf5d845c1fc670bbeb49804b5832c

Added in the rest.

The indexes are between 0 and patttern.size(). So if there's 50 stitches then each of those between 0..49 will have a stitch data.

zeepLi123 commented 2 months ago

Thank you very much for your answer, I can now get the coordinates of the stitches normally. I took a look at the document you sent, and it seems that it currently does not involve how to obtain the color change number of the embroidery file (such as DSB) and from which point the color change is performed. Could you please help me solve these two problems? Thank you very much:)