SeqAssignmentJson assigns the color sequences of an existing design to thread cones. Cone k is stitched with needle k + 1. It is sent with CreateTC, CreateTBF and CreatePNG as a JSON string: serialize the object shown in the example and send the result as the value of SeqAssignmentJson.
| EmbroideryType | SeqAssignmentJson |
|---|---|
DST | Required. The DST color sequences get the needles and colors of their cones. |
DSZ | Required. The file is converted to DST first; the sequence indexes refer to the converted DST. |
TC | Optional, from ServerVersion 3. Every sequence of the Z00 design gets the needle of its cone, and the color table of the design is replaced by the cone definitions. The stitches are not changed. |
TBF | Not used. |
CreateDST and CreateDSZ do not use SeqAssignmentJson.
Format
NeedleAssignment: object. Key: the cone index k ("0","1"...), a 0-based index intoUsedConeDefs; the cone is stitched with needle k + 1. Value: array with the 0-based indexes of the sequences stitched with this cone.UsedConeDefs: array with one cone definition per cone index.R,GandB(integers 0 to 255) are required.ColorNumber(integer),ColorName,ManufacturerandName(thread type) are optional.StartIndex: ignored. All indexes are 0-based.
DST and DSZ input
The sequence index is the 0-based index of the color sequence in the DST file (DSZ: in the converted DST).
TC input
- Sequence index: the 0-based position in the list that GetNeedleSequence returns for the design with
ServerVersion3. Every needle change and every stop starts a new sequence. - Complete assignment: every sequence must be assigned to exactly one cone.
UsedConeDefsmust have an entry for every cone index inNeedleAssignment. The highest needle is 32 (cone index 31). - No assignment: if
NeedleAssignmentis missing or empty, the design is used unchanged. - Cone colors win: entry n of the
Needlelist is replaced byUsedConeDefs[n - 1], so text withUsedNeedlen also gets that cone color."UseEmbroideryColors": 1is ignored. With text,Needlecan be omitted when everyUsedNeedlerefers to a cone. - Stops: if a sequence starts with a stop and gets a different cone than the sequence before it, a needle change is added after the stop. The
NeedleSequenceof the response then has one more entry than the GetNeedleSequence list of the input: the stop keeps the previous needle, and the added needle change starts the new one. - K-head: designs with K-head (Moos/Kettel) needles are rejected.
Example: GetNeedleSequence returns [7, 1, 24, 7, 2, 24] for a TC design, so it has the sequences 0 to 5. The example assigns sequences 0 and 3 to cone 0 (needle 1), sequences 1 and 4 to cone 1 (needle 2) and sequences 2 and 5 to cone 2 (needle 3). The created design uses the needles 1, 2, 3, 1, 2, 3 in the colors of the three cones. In the request:
"EmbroideryType": "TC",
"SeqAssignmentJson": "{\"NeedleAssignment\":{\"0\":[0,3],\"1\":[1,4],\"2\":[2,5]},\"UsedConeDefs\":[{\"R\":196,\"G\":30,\"B\":58,\"ColorNumber\":5566,\"ColorName\":\"radiant red\"},{\"R\":61,\"G\":142,\"B\":51,\"ColorNumber\":5540,\"ColorName\":\"kelly\"},{\"R\":234,\"G\":175,\"B\":15,\"ColorNumber\":5766,\"ColorName\":\"manila\"}]}"
Errors (TC input)
HTTP 400 with Success false and one of these texts in RequestData:
| RequestData | Cause |
|---|---|
ApplyNasTC: Sequence 1 is not assigned to a cone | A sequence of the design is missing in NeedleAssignment. |
ApplyNasTC: Sequence 1 is assigned to more than one cone | A sequence index is listed under more than one cone. |
ApplyNasTC: Sequence index 6 is out of range; the TC design has 6 sequences (0..5) | A sequence index is negative or not lower than the number of sequences. |
ApplyNasTC: Invalid cone index 3 (no cone definition or needle > 32) | A key of NeedleAssignment has no entry in UsedConeDefs, or it is negative or above 31. |
ApplyNasTC: The NAS is not supported for TC designs with K-head (Moos/Kettel) needles | The design uses K-head needles. |
ApplyNasTC: Invalid NAS data ... | SeqAssignmentJson is not a JSON object in the format above. |
ApplyNasTC: Invalid TC data ... / ApplyNasTC: The TC design has no needle sequence | The data cannot be read as TC, or it has no sequence. |