Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aras

Describe a garment in plain words and get a deterministic sewing pattern and product sheet back. It feels like prompting an AI but behaves like a compiler.

$ aras "make an oversized black hoodie with white sleeves, a grey hood and rib cuffs" -o hoodie.svg

The output is a one-page product sheet (a tech pack) with:

  • the product name and style code (Black Oversized Hoodie, ARS-HD-B205)
  • front and back flats in the colourway
  • a swatch for every colour, with the reason it has that colour
  • the construction decisions and their checks
  • a bill of materials: fabric per colour, rib, drawstring length, aglets, eyelets and thread
  • the cutting layout for each fabric

--marker gives the cutting layout at 1:1 with each piece printed in its colourway, and --pieces gives a printable paper pattern.

The same sentence always produces byte-identical output, and no model runs in the generation path.

To teach Aras new words (synonyms, colours, fabrics, construction words), see docs/VOCABULARY.md.

Gallery

Every garment type, each from the one sentence under it. Every image is the default product sheet; the SVGs next to them in gallery/ are 1:1 in millimetres. Regenerate them with bash gallery/render.sh.

Breton t-shirt make a navy and white striped t-shirt with long sleeves Boxy sage t-shirt make a boxy sage t-shirt with a cream collar
Colour-blocked hoodie make an oversized black hoodie with white sleeves, a grey hood and rib cuffs Forest green hoodie neatly make a forest green hoodie with a cream hood lining and cream drawstrings
Heather grey sweatshirt make a heather grey sweatshirt with navy rib trims Gingham shirt make a red gingham shirt
Pinstripe shirt simply make a short sleeve shirt in thin sky blue pinstripes Plaid shirt make a loose forest green plaid shirt
Tight black pants make tight black pants Pinstripe pants make dark grey pinstriped pants
Camo pants make baggy camo pants in dark blue and cream Olive baggy pants make baggy olive pants with an elastic waist
Sweep t-shirt make a white t-shirt with long sleeves and wheat, dark blue and forest green stripes from the hem into the sleeves, covering almost the whole shirt (design: Joose Hotari) Baby blue floral dress make a baby blue dress with short sleeves and small yellow flowers
Gathered polka dot dress make a navy and white polka dot midi dress with a gathered skirt and short sleeves Burgundy A-line dress make a sleeveless burgundy a-line dress
Red velvet dress make a red velvet dress (velvet: a nap, so every piece is cut one way up)

Dresses carry the top block down through the waist and hip. Each one makes these decisions:

  • Silhouette: shift, a_line, or a gathered skirt on a waist seam.
  • Length: mini, knee, midi or maxi, as a share of waist-to-floor.
  • Closure: a back zip, or pull-on. Pull-on is chosen only if the checks show the head goes through the neckline and the dress goes over the chest and seat at its waist.
  • Sleeves: short, long, or none. Sleeveless armholes get facings or bias binding.

Necklines get a facing or binding.

The same engine also writes the 1:1 cutting layout (--marker, left: the colour-blocked hoodie, one fabric per colour) and the printable paper pattern (--pieces, right: the gingham shirt, halves on the fold with notches, grainlines and a 10 cm test square):

Cutting layout Paper pattern

Why

AI image generators are bad at clothing because they guess pixels. Sewing already has fixed, well-documented rules:

  • matching seams are the same length
  • the sleeve cap fits the armhole
  • seam allowances and grading between sizes
  • a neckline must go over the head
  • stripes line up at the side seams

Aras applies those rules the way FeelRight applies music theory and Senne applies Rust idioms.

Architecture (same as FeelRight and Senne)

FeelRight Senne Aras Role
theory.rs lexicon.rs lexicon.rs closed vocabulary: garments, parts, changes, amounts, colours, prints
parser.rs parser.rs parser.rs tokens → garment spec + design spec
src/rules/ src/rules/ src/rules/ one file per construction decision; variants + drafting
— — src/blocks/ torso + sleeve and trouser blocks drafted from body measurements
search.rs search.rs search.rs beam over rule variants; finalists drafted, checked and laid out
rules.toml rules.toml rules.toml every number: size chart, fabrics, fits, weights, print repeats
tension curve modifiers modifiers "neatly", "simply", "cheaply" shift the finish/simplicity/economy profile
— judges judges consistent finish, rib as a second fabric, fabric use
— — src/design/ colourway rules, prints, flats
midi.rs codegen.rs svg.rs, product.rs product sheet, cutting layout, paper pattern

Construction. Every garment is drafted from a size chart (S–XL) with rules like these:

  • The sleeve cap height is solved so the cap is longer than the armhole by the fabric's cap ease (0–1 cm for knits, 1–3 cm for wovens). If the sleeve is too wide for the armhole, the armhole is deepened until it fits.
  • The back crotch point of pants is solved so the back inseam is 5 mm shorter than the front.
  • The back side-waist point is adjusted until both outseams are the same length.
  • Waist suppression the side seam can't take becomes a front pleat.
  • A hood's neck edge is solved to match the neckline exactly.
  • Bands and cuffs are cut shorter than the edge they're sewn to and stretched on.

Checks. A pattern is only output if every check passes:

  • matching seams are the same length (shoulder, side, underarm, inseam, outseam, collar, hood, waistband)
  • the head goes through the neckline and its band
  • the hand goes through the sleeve hem or cuff
  • the foot goes through the leg hem
  • the hips go through an elastic waist
  • the shoulder seam stays long enough
  • every outline is a simple polygon

Search. Each decision offers variants with finish/simplicity/economy scores:

  • hood: two- or three-piece, lined or single
  • cuffs: rib or hemmed
  • shirt collar: one-piece or with a stand
  • pants: zip fly or elastic waist
  • sleeve length: continue the taper or keep the hem width

Judges score combinations. Rib cuffs are worth more when the hem is ribbed too, and the first rib part costs a second fabric. The finalists are drafted for real: candidates that fail a check are dropped, and the rest pay for the fabric their layout uses. If nothing in the beam passes, every combination is tried.

Design. The sentence names some colours, and the rules fill in the rest:

  • Parts without their own colour take the body's.
  • Rib is knitted solid, so under a print it takes the print's ground colour.
  • A hood lining takes the hood's colour, or the print's second colour.
  • Drawstrings contrast with the hood; buttons and thread are tonal.
  • A single print colour gets its classic partner (off white on dark, navy on light).
  • Prints are anchored per piece so they match across seams. Body stripes start at the underarm line, sleeves at their underarm, and legs at the crotch line, all centred on centre front.
  • Colour-blocked garments get one fabric (and one cutting layout) per colour.

Garments

fits decisions
t-shirt fitted, regular, loose, oversized neck finish (rib band / self band / binding), sleeve finish, hood
hoodie same hood (2/3-piece, lined), cuffs, hem band, kangaroo pocket
sweatshirt same cuffs, hem band, neck finish
button shirt same collar (one-piece / stand), barrel cuffs or open hem, shirttail or straight hem
pants tight (stretch twill), regular, baggy zip fly or elastic waist, pleat when needed

Grammar, briefly

  • A garment noun starts the pattern: "make a hoodie", "baggy pants", "a long sleeve shirt in size L".
  • "with …" lists features until the next verb: "with long sleeves and a hood", "with rib cuffs, no pocket".
  • Change verbs take a part and an amount: "lengthen the sleeves by 2 inches", "make the collar wider", "crop it by 3 cm". Amounts need units. Without an amount, the [edits] default applies and --explain says so.
  • Colours go on the part after them ("white sleeves"), the part before them ("sleeves in red"), or the garment ("a navy hoodie"). "light"/"dark" shade them.
  • Prints: striped, vertical stripes, pinstriped, gingham/check, plaid/tartan, polka dot, camo, with "thin" or "thick" to scale the repeat. "black and white striped" gives the print both colours.
  • An unknown word is an error that suggests the closest known word (--lenient ignores it). The engine never guesses.

Usage

aras "sentence" -o out.svg      # product sheet
aras "..." --marker -o cut.svg  # 1:1 cutting layout in colour
aras "..." --pieces -o pat.svg  # printable pattern, halves on the fold, 10 cm test square
aras "..." --size XL            # size override
aras --base hoodie "widen the collar and lengthen the sleeves by two inches"
aras --explain "..."            # spec, every decision and score, finalists, checks, colourway (stderr)
aras --rules my_rules.toml      # different numbers
aras --vocabulary               # every known word and phrase

Oras: the garment on a dress form

oras puts what Aras drafts on a tailor's dress form and lets it hang:

oras "make a black satin dress with a cowl neck, an open back and a bow at the back" --out out/oras
  • The form is built from the size, not downloaded. Its waist, chest and seat are fitted so that a tape on the form reads the size's girths exactly (the report prints both). It has round bust domes at the bust points, a wider back at the shoulder blades, a neck and a stand.
  • The cloth:
    • The body pieces (front, back, a gathered skirt) are meshed from the flat pattern and hung in front of and behind the form.
    • Their seams are pulled shut while gravity is off. The shoulder seams are pinned to the form, as a dressmaker does, so a cowl's wider front shoulder is gathered in and its top drapes.
    • Then gravity is turned on. Position-based dynamics handles stretch, bending, seams, contact with the form (a signed distance field) and friction, with no randomness.
  • Out come view.html (three.js; drag to turn, g hides the garment, #front, #three, #side, #left, #back with an optional -bare), garment.obj and report.txt. The report gives seam gaps, the largest stretch, contact and penetration.
  • v0 limits: only the body pieces are simulated. Sleeves, collars, facings and bows are listed in the report as not simulated. The numbers live in [oras] in rules.toml.

The proof

cargo test runs:

  • Unit tests: every rule has one test where it applies and one where it doesn't, plus tests for the lexicon, parser, geometry, layout, colours, prints and judges.
  • tests/golden.rs:
    • each sentence in examples/*.txt must produce byte-identical output and match examples/out/*.svg
    • every example must pass every construction check, have simple outlines and non-overlapping pieces, and render all three sheet kinds deterministically
    • every garment must draft in every size, and grading must grow with size
    • stripes must anchor on the side seams and underarms

Run ARAS_BLESS=1 cargo test to accept intended output changes.

Non-goals for v0

  • no sleeveless tops, raglan sleeves, zips on tops, pockets on pants or jeans yet
  • layouts don't rotate pieces 180°, so legs don't nest head-to-toe
  • a printed fabric's layout assumes each piece is printed with its own anchored print (print-on-demand cut-and-sew), not cut from pre-printed yardage
  • the size chart is a standard-proportion unisex chart; replace [sizes] with your own measurements

License

PolyForm Noncommercial 1.0.0, see LICENSE. Free for personal, hobby, research, educational and other noncommercial use; commercial use needs a separate licence from the author. Patterns that Aras generates belong to whoever ran it.

About

Describe a garment in plain words, get a deterministic sewing pattern and product sheet. Lexicon + drafting rules + beam search, no neural network.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages