API & MCP

Everything a person can do on Threadsmith Marker Layout, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Threadsmith Marker Layout

Places pattern pieces on a fabric of the width you have, as tightly as a deterministic bottom-left fill can: every piece keeps its grainline along the selvage (turned 180° when allowed, 90° only for cross-grain cutting, never for napped or one-way fabric), pairs get a mirrored copy, and pieces cut on the fold are unfolded on open fabric or put against the fold of folded fabric. You get the marker length — how much fabric to buy — the efficiency (piece area ÷ fabric area), the lower bound, the position and turn of every piece, a picture of the layout and an SVG or DXF of the marker. Pieces come from a JSON list or are drafted on the spot from bust, waist and hip.

Inputs of Threadsmith Marker Layout
FieldTypeDefaultDescription
sourceselect (pieces, blocks)"pieces"Pieces from
unitsselect (cm, in)"cm"Units of all lengths
piecestextarea—Pieces (JSON). Array of {name, polygon: [[x, y], …] or path: "M … Z", grain (degrees, 90 = along +y), quantity, pair (true = half mirrored), fold: [[x1, y1], [x2, y2]]}. The whole result of threadsmith-pattern-block ({"pieces": […]}, in mm) is accepted too.
blocksmultiselect (skirt, bodice, sleeve, trousers)["skirt"]Blocks (when drafting)
bustnumber—Bust / chest girth (when drafting)
waistnumber—Waist girth (when drafting)
hipnumber—Hip girth (when drafting)
seamAllowancenumber—Seam allowance (when drafting). Empty = 1.5 cm or 5/8 in.
hemAllowancenumber—Hem allowance (when drafting). Empty = 4 cm or 1 1/2 in.
fabricWidthnumber—Usable fabric width. Selvage to selvage minus edges you cannot use. Empty = 140 cm or 54 in.
modeselect (open, folded)"open"Fabric
crossGrainbooleanfalseAllow cross-grain (90°) placement
nappedbooleanfalseNapped or one-way fabric (no 180° turns)
gapnumber—Gap between pieces. Empty = 0.
resolutionselect (2, 5, 10)"5"Layout raster
outputselect (svg, dxf)"svg"File

Example request

Known optimum: four 50 × 25 cm rectangles on 100 cm fill it completely

curl -X POST https://threadsmithmarkerlayout.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"source":"pieces","units":"cm","pieces":"[{\"name\":\"Panel\",\"polygon\":[[0,0],[50,0],[50,25],[0,25]],\"grain\":0,\"quantity\":4}]","fabricWidth":100}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "threadsmith-marker-layout": { "type": "http", "url": "https://threadsmithmarkerlayout.usefulweb.site/mcp" }
  }
}