Giter Club home page Giter Club logo

purebyuu's Introduction

Purebyuu

Read and parse a DST (Data Stitch Tajima) file, used as input for certain embroidery machines.

This project allows a file to be read, and the resulting commands written as a human readable list of stitches and jumps, or it can generate a SVG preview.

Main Goals

Reading a DST file and generating some kind of preview of it.

Usage

Create an instance of DstFile, passing it a stream representing a DST file, then call .Read() on it. Since we're dealing with IO in a stream, and it's 2018, it's async. Deal with it.

using Purebyuu;

var file = new DstFile(File.OpenRead(path));
await file.Read(cancellationToken);

The various output formats are found in Purebyuu.Output:

using Purebyuu;
using Purebyuu.Output;

var file = new DstFile(File.OpenRead(path));
await file.Read(cancellationToken);

File.WriteAllText("out.txt", CommandWriter.Write(file), Encoding.UTF8);
File.WriteAllText("out.svg", SvgWriter.Write(file), Encoding.UTF8);

These writers only return a string, delegating the storage logic to the calling application. Mash it into a file, stick it in a database, we don't care!

Design

The main entrypoint is the DstFile class. It contains the Header and the commands, represented by Pattern. A Pattern contains multiple stitch-blocks, which is separated by a set of jumps.

From what I can tell, and I'm absolutely not an expert, the jump should cause the machine to stop stitching, and there'll be no line from the last stitch to the first stitch after the jump.

Unsupported features

The file format doesn't really contain anywhere to put color information, from what I can see. A nice addition would be making the stitch color user configurable when generating an SVG.

There's also commands to enter and eject a sequin mode, which I have no idea what does. It currently has no effect on the preview document.

Another thing we could have implemented is building up a DST file from scratch, and/or writing our DstFile to a file. But it seems like a bit of a wasted effort, since I don't have an embroidery machine, nor am I likely to get access to one.

What's with the name?

The file format we're interested in supporting comes from Tajima, a Japanese company. When translating preview from English to Japanese, and then running the resulting translation through a romanization, I ended up with purubyuu, which sounds a bit like preview if pronounced in an exaggerated Asian accent.

License

MIT Licensed

Resources

purebyuu's People

Contributors

perfectlynormal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vb6hobbyst7

purebyuu's Issues

Couple quick explanations.

"There's also commands to enter and eject a sequin mode, which I have no idea what does. It currently has no effect on the preview document."

Sequins are little round shiny things that sometimes are applied to fabric. This is often sewn on by an embroidery machine. The sequin_mode command brings the hopper out and each time a JUMP is issued it ejects a sequin. So JUMP will at that point block the needlebar and eject a sequin on the specialty machines that have that attachment. For the most part they are ignored since it's not only an embroidery machine but a specialty embroidery machine that uses them. I have written some code that visualizes them at points. They are usually circles with like 3mm or 5mm diameters. You are perfectly fine ignoring them. I included them in the documentation for completeness, but the files with sequins are actually quite rare.

If you somehow wanted to visualize them, you actually could in a SVG, since they are generally circles with circles removed from them and throwing that in a <def> and calling it up in various places would be possible but even while I included every format known reading and writing, I never ever bothered to do that.

The files have no stitch information in them. While there are some additional formats like .edr that contain dst colors, these are rare. There's also sometimes extended dst headers which contain the thread information but these are even rarer than .edr. Most often a threadchart is printed up which lists the threads, colors, and order they are used. The machine itself reads DST and it comes from punchcard days and had no use for any color information.

--

Code all looks fine. Feel free to take liberally from https://github.com/EmbroidePy/pyembroidery if you need anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.