Skip to content
AlphaToolBox3D is in early alpha: features are incomplete and things can break. Use it at your own risk and keep copies of your files. Report a problem
ToolBox3D

Docs · Python API

tb.ops.garment

34 operations. Without targets=, an operation works on the current selection, like its button in the editor.

Bake Garment

tb.ops.garment.bake(
    *,
    session_id: str = ...,
    pose: Literal["settled", "current"] = "settled",
    next: bool = False,
    wrinkle_maps_later: bool = False,
) -> Result

Write the draped garment as ordinary editable meshes, welded and with thickness and smoothing modifiers as set, in one undo step, and close the session.

  • Operation garment.bake
  • In Model
ArgumentTypeDefaultDescription
session_idstr—The open session's id; a different id refuses.
poseLiteral["settled", "current"]"settled"Settled finishes the sewing and draping frames first; current bakes the displayed pose. (settled / current).
nextboolFalseOpen the next garment on the same avatars, keeping the reference image (in the same undo step).
wrinkle_maps_laterboolFalseLeave the LODs' wrinkle maps to bake afterwards: the result's wrinkleJobs token hands them to a background job (the Clothing panel shows its progress), each written with Bake Wrinkle Map.

Begin Garment

tb.ops.garment.begin(
    *,
    panels: Sequence[ObjectRef] = ...,
    avatars: Sequence[ObjectRef] = ...,
    clear_physics: bool = False,
    fabric: Literal["cotton", "jersey", "silk", "denim", "wool", "leather", "canvas", "nylon", "hide", "linen", "chiffon", "satin"] = ...,
    gravity: float = 9.81,
    assembly_frames: int = 90,
    drape_frames: int = 150,
    seam_strength: float = 1.0,
    seam_tolerance: float = 0.03,
    iterations: int = 24,
    ground_plane: bool = True,
    damping: float = ...,
    stretch_stiffness: float = 1.0,
    weft_stiffness: float = 1.0,
    warp_stiffness: float = 1.0,
    bias_stiffness: float = 1.0,
    bend_stiffness: float = 1.0,
    weight: float = 1.0,
    fabric_friction: float = 1.0,
    self_collision: bool = False,
    self_collision_thickness: float = 0.004,
    self_collision_iterations: int = 2,
    thickness: float = ...,
    smooth_levels: int = 1,
    weld_seams: bool = True,
    lods: int = 0,
    wrinkle_map: bool = True,
    name: str = ...,
) -> Result

Open a garment: your flat cloth panels are sewn and draped around avatar meshes in the Physics world. The garment is scene data (one undo step per change, saved with the project); Bake turns it into ordinary meshes.

  • Operation garment.begin
  • In Model
ArgumentTypeDefaultDescription
panelsSequence[ObjectRef]—Cloth panel mesh objects; defaults to the selected mesh objects.
avatarsSequence[ObjectRef]—Body or frame meshes the garment drapes over and collides with.
clear_physicsboolFalseFirst end the Physics World session and remove its simulated objects, which otherwise refuse the garment.
fabricLiteral["cotton", "jersey", "silk", "denim", "wool", "leather", "canvas", "nylon", "hide", "linen", "chiffon", "satin"]—Fabric of every panel without its own. (cotton / jersey / silk / denim / wool / leather / canvas / nylon / hide / linen / chiffon / satin).
gravityfloat9.81Draping gravity in metres per second squared. (0…50).
assembly_framesint90Frames sewn without gravity, so the seams close before the garment falls. (0…2000).
drape_framesint150Frames draped under gravity after sewing. (1…5000).
seam_strengthfloat1.01 sews rigidly; lower values let seams stretch. (0…1).
seam_tolerancefloat0.03Sewn sides whose lengths differ by more than this share show red in the seam list and while sewing. (percent; 0…0.5).
iterationsint24Cloth solver iterations per frame. (1…64).
ground_planeboolTrueA floor under the avatars' lowest point.
dampingfloat—Overrides every fabric's damping; leave out to keep the fabrics'. (0…10).
stretch_stiffnessfloat1.0How hard the fabric resists stretching and shearing, as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
weft_stiffnessfloat1.0How hard the cloth resists stretching across its grain (the flat piece's width), as a percentage of the rest of its stretch; a knit gives here. Picking a fabric resets it. (percent; 0.1…10).
warp_stiffnessfloat1.0How hard the cloth resists stretching along its grain (the flat piece's height), as a percentage of the rest of its stretch. Picking a fabric resets it. (percent; 0.1…10).
bias_stiffnessfloat1.0How hard the cloth resists stretching at 45 degrees to its grain, as a percentage of the rest of its stretch; low values give a bias cut's soft cling. Picking a fabric resets it. (percent; 0.1…10).
bend_stiffnessfloat1.0How hard the fabric resists bending (higher: wider, stiffer folds), as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
weightfloat1.0The fabric's weight per square metre as a percentage of its own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
fabric_frictionfloat1.0Friction against the body and other cloth, as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0…4).
self_collisionboolFalseKeep layers and folds from passing through each other.
self_collision_thicknessfloat0.004Gap kept between cloth layers; keep it below the panels' edge length. (scene units; 0.0001…0.1).
self_collision_iterationsint2Contact passes per frame. (1…16).
thicknessfloat—Bake thickness (a Solidify modifier); leave out to use the fabric's, 0 for none. (scene units; 0…0.1).
smooth_levelsint1Bake smoothing (a Subdivide modifier). (0…3).
weld_seamsboolTrueBake the panels into one mesh with their sewn edges welded.
lodsint0Game LODs baked beside the garment: copies named LOD1, LOD2 … each with half the faces of the one before. (0…3).
wrinkle_mapboolTrueBake the folds each LOD loses into a normal map on its own material, from the full garment.
namestr—Name of the baked object.

Add Base Body

tb.ops.garment.body.add(
    *,
    body: Literal["female", "male"],
    carry: bool = False,
    grade: bool = True,
) -> Result

Add a generic female or male mannequin to the scene; with a garment open it becomes the garment's avatar. One undo step.

  • Operation garment.body.add
  • In Model
ArgumentTypeDefaultDescription
bodyLiteral["female", "male"]requiredWhich body. (female / male).
carryboolFalseWith a garment draped, carry its fit and folds onto this body (see Refit Garment).
gradeboolTrueWith a garment made, grade its pattern to this body (see Refit Garment).

Discard Garment

tb.ops.garment.cancel(*, session_id: str = ..., next: bool = False) -> Result

Discard the open garment and delete the pieces it made (objects it began with stay in the scene); one undo step.

  • Operation garment.cancel
  • In Model
ArgumentTypeDefaultDescription
session_idstr—The open session's id; a different id refuses.
nextboolFalseOpen the next garment on the same avatars, keeping the reference image.

Garment Capabilities

tb.ops.garment.describe() -> Result

List the starter fabrics, the session settings with their defaults and what a garment session supports. Read-only.

  • Operation garment.describe
  • In Model

Edit Garment

tb.ops.garment.edit(
    *,
    session_id: str = ...,
    panels: Sequence[ObjectRef] = ...,
    avatars: Sequence[ObjectRef] = ...,
    panel: Any = ...,
    outfit: Any = ...,
    add_seam: Any = ...,
    add_seams: Any = ...,
    remove_seam: str = ...,
    sew_on: Any = ...,
    flip_seam: str = ...,
    resew_seam: Any = ...,
    add_pin: Any = ...,
    remove_pin: str = ...,
    add_tack: Any = ...,
    remove_tack: str = ...,
    add_quilt: Any = ...,
    zipper: Any = ...,
    remove_quilt: str = ...,
    add_line: Any = ...,
    pleat_line: Any = ...,
    fold_line: Any = ...,
    edit_line: Any = ...,
    piece_state: Any = ...,
    elastic_line: Any = ...,
    drawstring_line: Any = ...,
    topstitch_line: Any = ...,
    topstitch_seam: Any = ...,
    remove_line: str = ...,
    reference: Any | None = ...,
    redrape: bool = ...,
    staged: str = ...,
    fabric: Literal["cotton", "jersey", "silk", "denim", "wool", "leather", "canvas", "nylon", "hide", "linen", "chiffon", "satin"] = ...,
    gravity: float = 9.81,
    assembly_frames: int = 90,
    drape_frames: int = 150,
    seam_strength: float = 1.0,
    seam_tolerance: float = 0.03,
    iterations: int = 24,
    ground_plane: bool = True,
    damping: float = ...,
    stretch_stiffness: float = 1.0,
    weft_stiffness: float = 1.0,
    warp_stiffness: float = 1.0,
    bias_stiffness: float = 1.0,
    bend_stiffness: float = 1.0,
    weight: float = 1.0,
    fabric_friction: float = 1.0,
    self_collision: bool = False,
    self_collision_thickness: float = 0.004,
    self_collision_iterations: int = 2,
    thickness: float = ...,
    smooth_levels: int = 1,
    weld_seams: bool = True,
    lods: int = 0,
    wrinkle_map: bool = True,
    name: str = ...,
) -> Result

Change the open garment: fabric and settings, panels, avatars, seams, pins, internal lines and the reference image. One undo step, together with the look a piece whose fabric changed now wears.

  • Operation garment.edit
  • In Model
ArgumentTypeDefaultDescription
session_idstr—The open session's id; a different id refuses.
panelsSequence[ObjectRef]—Replace the cloth panels.
avatarsSequence[ObjectRef]—Replace the avatar meshes.
panelAny—{node, fabric?, layer?, garment?, keepPlace?, pressure?, bendStiffness?}: bendStiffness (0.1 to 10 times its fabric's, null or 1 for the fabric's own) stiffens or softens the piece's bending, as an interlining fused to it does; pressure (0 to 100, 0 or null for none) fills the closed shape the piece is sewn into with the other pressured pieces it is sewn to, like air in a cushion; one panel's own fabric (null uses the garment's), its layer (0 on the body to 4; a piece moved up a layer starts 2 cm further out per layer unless keepPlace, and layered pieces collide with each other) and the garment it is part of (a name such as "T-Shirt", null for a drawn piece; the Outfit lists each garment as one row).
outfitAny—[name, ...]: the garments inner to outer (null for the drawn pieces); each is stacked on the layer above the one before, its pieces moved out with it and kept in their layers relative to each other. Garments left out follow in their current order.
add_seamAny—{nodeA, startA, endA, nodeB, startB, endB, strength}: sew two open boundary segments (world points), as the Sew tool does.
add_seamsAny—{sides: [{node, start, end}, ...], to: {node, start, end}, strength?}: sew several open boundary segments (world points) to one, the one split in proportion to their lengths, in order from its start; one seam per side.
remove_seamstr—A seam's id.
sew_onAny—{piece, line, closed?}: sew a piece onto another piece's surface along one of its internal lines, draped with its host and a layer over it. Along an inner shape (a closed line: a pocket, a patch) the piece's outline goes round it, its top left open unless closed; along an open line (a placket, a trim) the piece's longest side runs down it. Stitches are spread by length on both sides.
flip_seamstr—A seam's id: sew its second side the other way round (a crossed seam uncrossed).
resew_seamAny—{seam, startB, endB}: sew a seam's second side again between new world points on its piece (either may be left out); the first side stays.
add_pinAny—{node, vertices} or {node, selected: true}: hold these panel vertices (or the selected ones) where the drape starts.
remove_pinstr—A pin's id.
add_tackAny—{a: {node, point: [x, y] | vertex}, b: {node, point: [x, y] | vertex}, button?: diameter in metres, buttonhole?: true for b to be a slit the button passes through, trim?: the button's trim (a Trims Library id such as "snap", a garment trim's id, or a saved trim {name, kind, positions, faces}; default the sew-through button)}: hold two points of the garment together through the drape (each a point in the piece's flat frame as Read Pattern reports it, held exactly: a point more than a millimetre off every vertex refills the piece keeping it as a vertex; or a vertex of the piece's mesh picked on the 3D cloth): a belt loop, a strap's end, a tufting button.
remove_tackstr—A tack's id.
add_quiltAny—{piece, lining, pairs: [[piece vertex, lining vertex, fill height in metres], ...]}: sew a piece to its lining in quilted channels (Quilt Pattern Piece makes these).
zipperAny—{seam, open?, fromStart?}: make a seam a zipper and set how far it is open (0 closed to 1 open): open unzips from the seam's end, fromStart (two-way) from its start; open null makes it a sewn seam again.
remove_quiltstr—A quilt's id; the lining stays a piece.
add_lineAny—{node, points: [[x, y], ...] in metres in the panel's flat frame (as Read Pattern reports it), curves?: one [inX, inY, outX, outY] handle pair (or null) per point, closed?}: draw an internal line on a panel, or with closed an inner shape (a pocket's place).
pleat_lineAny—{line, kind?, count?, depth?, direction?}: pleats along an open internal line: kind knife (the default), box or accordion; count 1-12 (4); depth in metres 0.005-0.2 (0.03); direction valley (the default) or mountain for the line's own fold. The line becomes the first fold and copies of it are laid across it on its left, each a signed fold.
fold_lineAny—{line, angle?, strength?, direction?, width?}: make an open internal line a fold: angle in degrees from flat (0 a free hinge, 180 folded flat), strength 0 (a soft roll) to 1 (knife-sharp), direction valley (towards the piece's front, the default) or mountain (away from it), width in metres 0-0.2 (0.04: how far either side of the line the cloth shares the turn). None of them clears the fold.
edit_lineAny—{line, points: [[x, y], ...], curves?}: give an internal line new points (in its piece's flat frame) and curve handles (one [inX, inY, outX, outY] or null per point); moving a line is new points.
piece_stateAny—{node or nodes, state}: 'simulate', 'frozen' (holds its current shape, also through Reset, and still collides) or 'off' (out of the simulation and of collision).
elastic_lineAny—{line, ratio?} puts elastic along an open internal line (Marvelous Designer's elastic): the cloth along it gathers to ratio (0.5 to 1) of its cut length as it drapes, as a waistband or a cuff grips the body. {line} alone takes it off.
drawstring_lineAny—{line, tail?} runs a drawstring through an open internal line: a cord tail metres long (0.05 to 1), a narrow piece of the garment tacked at the line's first point, hangs from there and drapes with it; Bake adds an eyelet there and turns the cord round where it hangs. {line} alone takes it off (and its cord).
topstitch_lineAny—{line, length?, width?} stitches an open internal line, baked into the normal map at Bake; {line} alone removes the stitching. Metres.
topstitch_seamAny—{seam, inset?, length?, width?} adds a stitched line on each side of a seam, inset metres from the edge.
remove_linestr—An internal line's id.
referenceAny | None—{texture, width, center: [x, y], opacity}: the Pattern Editor's reference image (a library texture, its width in metres, center in metres, opacity 0.05 to 1); null removes it.
redrapebool—Drape again after the edit.
stagedstr—Internal: a garment change prepared by another garment operation.
fabricLiteral["cotton", "jersey", "silk", "denim", "wool", "leather", "canvas", "nylon", "hide", "linen", "chiffon", "satin"]—Fabric of every panel without its own. (cotton / jersey / silk / denim / wool / leather / canvas / nylon / hide / linen / chiffon / satin).
gravityfloat9.81Draping gravity in metres per second squared. (0…50).
assembly_framesint90Frames sewn without gravity, so the seams close before the garment falls. (0…2000).
drape_framesint150Frames draped under gravity after sewing. (1…5000).
seam_strengthfloat1.01 sews rigidly; lower values let seams stretch. (0…1).
seam_tolerancefloat0.03Sewn sides whose lengths differ by more than this share show red in the seam list and while sewing. (percent; 0…0.5).
iterationsint24Cloth solver iterations per frame. (1…64).
ground_planeboolTrueA floor under the avatars' lowest point.
dampingfloat—Overrides every fabric's damping; leave out to keep the fabrics'. (0…10).
stretch_stiffnessfloat1.0How hard the fabric resists stretching and shearing, as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
weft_stiffnessfloat1.0How hard the cloth resists stretching across its grain (the flat piece's width), as a percentage of the rest of its stretch; a knit gives here. Picking a fabric resets it. (percent; 0.1…10).
warp_stiffnessfloat1.0How hard the cloth resists stretching along its grain (the flat piece's height), as a percentage of the rest of its stretch. Picking a fabric resets it. (percent; 0.1…10).
bias_stiffnessfloat1.0How hard the cloth resists stretching at 45 degrees to its grain, as a percentage of the rest of its stretch; low values give a bias cut's soft cling. Picking a fabric resets it. (percent; 0.1…10).
bend_stiffnessfloat1.0How hard the fabric resists bending (higher: wider, stiffer folds), as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
weightfloat1.0The fabric's weight per square metre as a percentage of its own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0.1…10).
fabric_frictionfloat1.0Friction against the body and other cloth, as a percentage of the fabric's own; leave out to keep the fabric's. Picking a fabric resets it. (percent; 0…4).
self_collisionboolFalseKeep layers and folds from passing through each other.
self_collision_thicknessfloat0.004Gap kept between cloth layers; keep it below the panels' edge length. (scene units; 0.0001…0.1).
self_collision_iterationsint2Contact passes per frame. (1…16).
thicknessfloat—Bake thickness (a Solidify modifier); leave out to use the fabric's, 0 for none. (scene units; 0…0.1).
smooth_levelsint1Bake smoothing (a Subdivide modifier). (0…3).
weld_seamsboolTrueBake the panels into one mesh with their sewn edges welded.
lodsint0Game LODs baked beside the garment: copies named LOD1, LOD2 … each with half the faces of the one before. (0…3).
wrinkle_mapboolTrueBake the folds each LOD loses into a normal map on its own material, from the full garment.
namestr—Name of the baked object.

Apply Fabric Looks

tb.ops.garment.fabric.look(*, pieces: Any = [], fabrics: Any = []) -> Result

Give garment pieces their fabric's look: each piece is bound to the project material named for its fabric ("Denim Fabric"), made with the fabric's color, roughness, sheen and weave (color and normal textures laid along the grain at the weave's real size) the first time it is needed and kept afterwards for editing. The open garment does this itself whenever a piece's fabric changes. Fabrics: cotton, jersey, silk, denim, wool, leather, canvas, nylon, hide, linen, chiffon, satin. One undo step.

  • Operation garment.fabric.look
  • In Model
ArgumentTypeDefaultDescription
piecesAny[]List of {node, fabric}: a piece mesh object and a fabric key.
fabricsAny[]Fabric keys whose materials to make without binding them (Edit Look opens one before any piece wears it).

Make Panel

tb.ops.garment.make_panel(
    *,
    curve: ObjectRef = ...,
    edge_length: float = 0.02,
    keep_curve: bool = False,
    name: str = ...,
) -> Result

Turn a closed curve into a flat cloth panel of even quads: the outline keeps its corners, laid flat on its best-fit plane. The curve is replaced unless Keep Curve is on; with Clothing open the panel joins the garment. One undo step.

  • Operation garment.make_panel
  • In Model
ArgumentTypeDefaultDescription
curveObjectRef—The closed curve object; defaults to the selected curve.
edge_lengthfloat0.02About how long each quad edge is: smaller gives finer folds and a slower drape. (scene units; 0.002…1).
keep_curveboolFalseKeep the curve beside the new panel.
namestr—Name of the panel object.

Add Pattern Pieces

tb.ops.garment.pattern.add(
    *,
    pieces: Any,
    seams: Any = ...,
    sew_on: Any = ...,
    tacks: Any = ...,
    edge_length: float = 0.02,
    avatars: Sequence[ObjectRef] = ...,
) -> Result

Turn 2D pattern pieces into flat cloth panels of even quads, laid out in front of the garment's avatar (or at each piece's saved placement), and sew the pattern's seams. With Clothing open the panels join the garment. One undo step.

  • Operation garment.pattern.add
  • In Model
ArgumentTypeDefaultDescription
piecesAnyrequiredList of {outline: [[x, y], ...] in metres (counter-clockwise or not), lines?: [{points: [[x, y], ...], curves?, closed?, drawstring?, fold?: {angle, strength, direction, width} as Edit Garment foldLine, topstitch?: {length, width}}] internal lines in the outline's frame (with Clothing open), curves?: one [inX, inY, outX, outY] handle pair (offsets in metres) or null per outline point, making the outline control points joined by Bezier sides (kept on the panel for editing), symmetric?: with curves, the piece's halves are edited as mirror images, mirrorAngle?: the mirror line's turn from the vertical in degrees (counter-clockwise, default 0), name?, fabric?, garment?: the garment the piece is part of (the Outfit's row, e.g. "T-Shirt"), layer?: 0 on the body to 4 (with Clothing open), notches?: [[x, y], ...] on the outline, side?: front | back | left | right (which side of the avatar it lines up on, facing out; default front), level?: its center's height as a share of the avatar's height, pane?: [x, y] its place in the Pattern Editor, quilt?: {style?, spacing?, loft?, button?} Quilt Pattern Piece settings it is quilted with once sewn (with Clothing open), placement?: 16-number column-major world matrix of the flat frame}.
seamsAny—List of {a, startA, endA, b, startB, endB, strength?}: piece indices and flat-frame boundary points of the two sewn segments.
sew_onAny—With Clothing open, list of {piece, host, line, closed?}: sew piece (an index) onto the host piece's surface along the host's line (an index into its lines), as garment.edit sewOn does (a shirt's placket; closed sews a pocket's top shut too).
tacksAny—With Clothing open, list of {a: {piece, point: [x, y]}, b: {piece, point}, button?, buttonhole?}: tack two points of the pattern's pieces together (piece indices, points in each piece's outline frame like the internal lines), as garment.edit addTack does (a coat's buttons down its front band).
edge_lengthfloat0.02About how long each quad edge is. (scene units; 0.002…1).
avatarsSequence[ObjectRef]—Bodies the new pieces line up in front of; defaults to the open garment's avatars.

Arrange Pattern

tb.ops.garment.pattern.arrange(*, places: Any) -> Result

Save where pieces sit in the Pattern Editor, one undo step; the arrangement is kept with the garment in the project and comes back when Clothing opens again.

  • Operation garment.pattern.arrange
  • In Model
ArgumentTypeDefaultDescription
placesAnyrequiredList of {node, at: [x, y] in metres, or null to forget the piece's place}.

Cut Pattern Piece

tb.ops.garment.pattern.cut(
    *,
    node: ObjectRef,
    from_: Any = ...,
    to: Any = ...,
    line: str = ...,
    sew: bool = False,
) -> Result

Cut a piece in two along a straight line through it (in its flat frame); the new piece stays where it was, in the same fabric, and seams follow the part they were on. With sew, the two cut sides are sewn back together (Cut & Sew). One undo step for the pieces; seams are garment steps.

  • Operation garment.pattern.cut
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe piece (a panel of the open garment).
from_Any—[x, y]: a point on the cut line, in metres in the piece's flat frame.
toAny—[x, y]: another point on the cut line; the line runs on through the whole piece.
linestr—Cut along an open internal line of the piece instead (its first and last points); the line is removed.
sewboolFalseSew the two cut sides together (Cut & Sew).

Add Dart

tb.ops.garment.pattern.dart(
    *,
    node: ObjectRef,
    side: int,
    at: float = 0.5,
    width: float = 0.03,
    depth: float = 0.08,
) -> Result

Take a dart in from one side of a piece: a V of the given width and depth, its two legs sewn together so the cloth shapes over the body. The piece is one undo step, the dart's seam one garment step.

  • Operation garment.pattern.dart
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe piece (a panel of the open garment).
sideintrequiredThe side's index in the piece's design (Read Pattern lists the outline points; side k runs from point k to the next). (0…4096).
atfloat0.5The dart's middle as a share of the side's length from its start. (factor; 0.05…0.95).
widthfloat0.03The dart's opening on the side, in metres. (scene units; 0.002…0.3).
depthfloat0.08How far the dart's point reaches into the piece, in metres. (scene units; 0.005…0.5).

Grade Pattern

tb.ops.garment.pattern.grade(
    *,
    nodes: Sequence[ObjectRef] = ...,
    width: float = 100.0,
    height: float = 100.0,
) -> Result

Grade pattern pieces to another size: each piece grows or shrinks about its center by the width and height percentages in its flat frame, refilled with quads; seams and notches follow the graded sides. One undo step.

  • Operation garment.pattern.grade
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—The pieces; defaults to the selected pieces, else every piece of the open garment.
widthfloat100.0New width as a share of the current one. (percent; 50…200).
heightfloat100.0New height as a share of the current one. (percent; 50…200).

Import Pattern

tb.ops.garment.pattern.import_(
    *,
    data: str,
    format: Literal["svg", "dxf"] = "svg",
    scale: float = 1.0,
    edge_length: float = 0.02,
) -> Result

Read the closed outlines of an SVG or DXF drawing (millimetres, or pixels at 96 dpi) as pattern pieces and add them like Add Pattern Pieces, keeping the drawing's layout. One undo step.

  • Operation garment.pattern.import
  • In Model
ArgumentTypeDefaultDescription
datastrrequiredThe drawing file's text.
formatLiteral["svg", "dxf"]"svg"Format (svg / dxf).
scalefloat1.0Drawing size multiplier: 1 keeps the drawn size, 10 for a drawing in centimetres saved as millimetres. (0.001…1000).
edge_lengthfloat0.02Edge Length (scene units; 0.002…1).

Pattern Library

tb.ops.garment.pattern.library(
    *,
    id: str = ...,
    fit: Literal["slim", "regular", "loose"] = "regular",
    length: Literal["short", "regular", "long"] = "regular",
) -> Result

The starting patterns that ship with ToolBox3D (tank top, dress, skirt …): each with its pieces, notches and seams, ready for Add Pattern Pieces and fully editable after.

  • Operation garment.pattern.library
  • In Model
ArgumentTypeDefaultDescription
idstr—One pattern's id; without it, every pattern.
fitLiteral["slim", "regular", "loose"]"regular"With id: the pieces' width, slim or loose about the regular cut (accessories come in one size). (slim / regular / loose).
lengthLiteral["short", "regular", "long"]"regular"With id: the hem 6 cm higher (short) or 8 cm lower (long); the top stays where it is worn. (short / regular / long).

Merge Pattern Pieces

tb.ops.garment.pattern.merge(*, seam: str) -> Result

Join the two pieces a seam sews into one piece, laid together along the seam: the first piece takes the second's outline, its other seams follow, and the second piece is deleted. One undo step for the pieces; seams are garment steps.

  • Operation garment.pattern.merge
  • In Model
ArgumentTypeDefaultDescription
seamstrrequiredThe seam's id (Garment State lists them); it must join two different pieces.

Notch Pattern Piece

tb.ops.garment.pattern.notch(
    *,
    node: ObjectRef,
    at: Any,
    remove: bool = False,
) -> Result

Add (or remove) a notch on a cloth panel's outline: a sewing mark at the boundary point nearest the given flat-frame point. Notches show in the Pattern Editor, Sew Edges snaps to them, and they follow reshapes and grading. One undo step.

  • Operation garment.pattern.notch
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe panel.
atAnyrequired[x, y] in metres in the panel's flat frame (the frame Read Pattern reports).
removeboolFalseRemove the notch there instead.

Offset Pattern Piece

tb.ops.garment.pattern.offset(*, node: ObjectRef, distance: float) -> Result

Grow (or shrink) a piece's outline by a distance all round, corners mitred, the curves kept; its seams follow the moved sides. One undo step.

  • Operation garment.pattern.offset
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe piece (a panel of the open garment).
distancefloatrequiredHow far each side moves out (negative: in), in metres. (scene units; -0.5…0.5).

Quilt Pattern Piece

tb.ops.garment.pattern.quilt(
    *,
    node: ObjectRef,
    style: Literal["channels", "diamond", "tufted"] = "channels",
    button: float = 0.02,
    spacing: float = 0.08,
    sleeve: Any = ...,
    loft: float = 0.015,
) -> Result

Quilt a piece: its outline is added again as a lining just inside it, sewn to it round the outline and along quilting lines (parallel channels or diamonds) with the fill puffing each channel up to the loft as it drapes. One undo step for the lining and its stitching.

  • Operation garment.pattern.quilt
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe piece (a panel of the open garment).
styleLiteral["channels", "diamond", "tufted"]"channels"Channels: parallel lines across the piece; diamond: two sets of lines crossing at right angles, on the diagonal; tufted: held down only where the diamond lines cross, the fill puffing between and the pleats falling along the diagonals. (channels / diamond / tufted).
buttonfloat0.02Tufted: the button sewn on at each tuft (its diameter, added at Bake); 0 for none. (scene units; 0…0.1).
spacingfloat0.08Distance between quilting lines, in metres. (scene units; 0.03…0.4).
sleeveAny—Channels on a top with cut-on sleeves: {underarm: [x, y], shoulder: [x, y], cuff: [x, y]} on the piece's right half (the armhole's ends and the cuff's middle), so past the armhole the channels run round the arm and the armhole is stitched.
loftfloat0.015How far the fill holds the piece from its lining in the middle of a channel, in metres. (scene units; 0…0.1).

Read Pattern

tb.ops.garment.pattern.read() -> Result

The open garment's pattern: each panel's flat outline in metres, notches, place in the Pattern Editor, fabric and placement, and the seams as flat boundary segments. Save it and pass it to Add Pattern Pieces to rebuild the garment.

  • Operation garment.pattern.read
  • In Model

Pattern Reference Image

tb.ops.garment.pattern.reference(
    *,
    staged: str = ...,
    texture: str = ...,
    width: float = ...,
    centre: Any = ...,
    opacity: float = ...,
    clear: bool = False,
) -> Result

Show an image behind the Pattern Editor's pieces to trace over (a scanned pattern, a sketch), at a real width in metres; kept in the project. Pass staged (a picked file) or texture, or clear to remove it; width, center and opacity adjust it.

  • Operation garment.pattern.reference
  • In Model
ArgumentTypeDefaultDescription
stagedstr—Token from tb_api::stage_texture (the picked image file).
texturestr—Id or name of a library texture to show.
widthfloat—The image's width in the Pattern Editor, in metres (default 1 m). (scene units; 0.05…10).
centreAny—[x, y]: the image's center in the Pattern Editor, in metres (default 0, 0).
opacityfloat—How solid the image is drawn (default 0.5). (factor; 0.05…1).
clearboolFalseRemove the reference image.

Reshape Pattern Piece

tb.ops.garment.pattern.reshape(
    *,
    node: ObjectRef,
    outline: Any,
    curves: Any = ...,
    symmetric: bool = False,
    mirror_angle: float = 0.0,
    before: Any = ...,
    keep: Any = ...,
    edge_length: float = ...,
) -> Result

Give a flat cloth panel a new outline in its flat frame (the frame Read Pattern reports) and refill it with quads; the panel stays where it is. With Clothing open its seams follow: pass the outline it was edited from as before (point for point) and each seam end keeps its place along the edited sides. One undo step.

  • Operation garment.pattern.reshape
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe panel to reshape.
outlineAnyrequiredThe new outline: [[x, y], ...] in metres, in the panel's flat frame.
curvesAny—One [inX, inY, outX, outY] handle pair (offsets in metres) or null per outline point: the outline is then control points joined by Bezier sides, kept on the panel for editing.
symmetricboolFalseWith curves: the piece is symmetric about a line through the middle of its points (vertical unless mirrorAngle turns it), and the Pattern Editor edits its two halves as mirror images.
mirror_anglefloat0.0With symmetric: the mirror line's turn from the vertical in degrees, counter-clockwise (a symmetric piece turned in the Pattern Editor). (-360…360).
beforeAny—The outline the new one was edited from, with as many points; seam ends move with its sides. Without it they stay where they are.
keepAny—[[x, y], ...] flat-frame points on the new outline to hold as exact boundary vertices (with Clothing open, the moved seam ends are added).
edge_lengthfloat—About how long each quad edge is; defaults to the panel's current edge length. (scene units; 0.002…1).

Place Tuft

tb.ops.garment.pattern.tuft(*, node: ObjectRef, at: Any, remove: bool = False) -> Result

Hold a quilted piece down to its lining at a point of your choosing (a tuft): the stitched piece vertex nearest the point, off the outline, is sewn to its lining at no length, so the fill puffs round it. With remove, the tuft nearest the point is let go and its fill comes back. One undo step.

  • Operation garment.pattern.tuft
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredThe quilted piece (a panel of the open garment).
atAnyrequired[x, y]: the point, in metres in the piece's flat frame.
removeboolFalseLet go of the tuft nearest the point instead.

Move Placement Point

tb.ops.garment.placement.move(
    *,
    point: str,
    position: Any = ...,
    normal: Any = ...,
    reset: bool = False,
) -> Result

Move one of the open garment's placement points to a spot on the avatar (or reset it). A garment edit, undone with the garment's own Undo.

  • Operation garment.placement.move
  • In Model
ArgumentTypeDefaultDescription
pointstrrequiredThe point's id.
positionAny—[x, y, z] world metres on the avatar's surface.
normalAny—[x, y, z] the surface's outward direction there.
resetboolFalsePut the point back where the avatar's shape puts it.

Place Pieces

tb.ops.garment.placement.place(
    *,
    point: str,
    nodes: Sequence[ObjectRef] = ...,
    offset: float = 0.06,
) -> Result

Put pieces of the open garment at a placement point, facing out from the body (several pieces sit side by side). One undo step.

  • Operation garment.placement.place
  • In Model
ArgumentTypeDefaultDescription
pointstrrequiredThe point's id, e.g. chest, back, left_arm.
nodesSequence[ObjectRef]—The pieces; defaults to the selected pieces.
offsetfloat0.06How far out from the body the pieces sit. (scene units; 0…0.5).

Placement Points

tb.ops.garment.placement.points() -> Result

The open garment's placement points on its avatar: chest, back, waist, arms and legs, each with its surface position and outward normal (world metres). Read-only.

  • Operation garment.placement.points
  • In Model

Refit Garment

tb.ops.garment.refit(
    *,
    avatars: Sequence[ObjectRef],
    grade: bool = True,
    carry: bool = False,
) -> Result

Move the open garment onto another character: every piece keeps its place on the body (scaled with its height, width and depth), the pattern is graded by the change in girth and height (quilted pieces are graded and quilted again), placement points you moved follow onto the new body, and the character becomes the garment's avatar, in whatever pose it stands; drape again to settle it. With carry, the drape itself moves onto the new body too, keeping fit and folds. One undo step.

  • Operation garment.refit
  • In Model
ArgumentTypeDefaultDescription
avatarsSequence[ObjectRef]requiredThe new character's meshes.
gradeboolTrueGrade the pattern to the new body's girth and height (pieces are refilled). Off keeps every piece's mesh and UVs exactly and only moves it.
carryboolFalseCarry the current drape onto the new body: the next drape starts from it, resting on the pattern (graded unless grade is off). Needs a draped garment.

Match Seam Lengths

tb.ops.garment.seam.match(*, seam: str) -> Result

True a seam of the open garment: its second side's piece is reshaped so that side is as long as the first, by moving the corner the sewn side ends on along it; a sewn side that ends mid-side slides its end along the outline instead (a point is added there, the piece keeps its shape). A symmetric piece's other half follows. One undo step.

  • Operation garment.seam.match
  • In Model
ArgumentTypeDefaultDescription
seamstrrequiredThe seam's id (Garment State lists them).

Drape Garment

tb.ops.garment.simulate(
    *,
    session_id: str = ...,
    action: Literal["drape", "play", "pause", "step", "reset"],
    frames: int = 10,
) -> Result

Sew and drape the garment: drape runs the sewing then draping frames from the start, play and pause run it live, step advances, reset returns the flat panels.

  • Operation garment.simulate
  • In Model
ArgumentTypeDefaultDescription
session_idstr—The open session's id; a different id refuses.
actionLiteral["drape", "play", "pause", "step", "reset"]requiredAction (drape / play / pause / step / reset).
framesint10Frames for step. (1…5000).

Garment State

tb.ops.garment.state(*, session_id: str = ..., include_geometry: bool = False) -> Result

Read the open garment session (null without one): panels, avatars, seams, pins, settings, drape stage and quality (largest seam gap and pin drift).

  • Operation garment.state
  • In Model
ArgumentTypeDefaultDescription
session_idstr—The open session's id; a different id refuses.
include_geometryboolFalseAlso return each panel's current world positions in metres.

Bake Topstitching

tb.ops.garment.topstitch_bake(*, material: MaterialRef, staged: str) -> Result

Bake Garment's step that lays the garment's stitched lines into its normal map. Run Bake Garment, which plans the map.

  • Operation garment.topstitch_bake
  • In Model
ArgumentTypeDefaultDescription
materialMaterialRefrequiredThe fabric's material.
stagedstrrequiredInternal: the map Bake Garment planned.

Apply Trim

tb.ops.garment.trim.apply(
    *,
    trim: Any = ...,
    mesh: ObjectRef = ...,
    kind: Literal["button", "puller"] = "button",
    tacks: Any = ...,
) -> Result

Put a trim on the open garment, one undo step: a button-like trim on its buttons (all of them, or the tacks named), a puller on every zipper. The trim is a Trims Library id, one of the garment's own trims, a {name, kind, positions, faces} object in trim units (a saved trim), or a mesh object of yours with its kind.

  • Operation garment.trim.apply
  • In Model
ArgumentTypeDefaultDescription
trimAny—A Trims Library id ("snap"), a garment trim's id, or {name, kind, positions, faces} in trim units.
meshObjectRef—Instead of trim: a mesh object of yours, made into a trim (its thinnest side faces out of the cloth).
kindLiteral["button", "puller"]"button"With mesh: what the mesh is fastened as. (button / puller).
tacksAny—With a button-like trim: the button tacks' ids to change; without, every button of the garment.

Trims Library

tb.ops.garment.trim.library() -> Result

The trims that ship with ToolBox3D: buttons, a snap, a rivet and a toggle (sewn on with a tack's button) and zipper pullers. Each with its id, name, kind (button or puller) and usual size.

  • Operation garment.trim.library
  • In Model

Bake Wrinkle Map

tb.ops.garment.wrinkle_map(
    *,
    material: MaterialRef,
    high: ObjectRef = ...,
    size: int = 1024,
    staged: str = ...,
) -> Result

Bake the folds of a detailed garment into a normal map for a lower-detail copy: the map is projected from the high mesh (with its smoothing) onto the copy's UVs and bound as its material's normal texture. Bake Garment runs it for each LOD. One undo step.

  • Operation garment.wrinkle_map
  • In Model
ArgumentTypeDefaultDescription
materialMaterialRefrequiredThe low-detail copy's own material (it gets the normal map).
highObjectRef—The detailed garment whose folds are baked.
sizeint1024Texture size in pixels (square). (256…4096).
stagedstr—Internal: a map baked in the background (the Clothing panel's progress).