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.physics

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

Apply Simulation

tb.ops.physics.apply(*, staged: str = ..., cloth: str = ...) -> Result

Apply the current paused and displayed world as one undo step: rigid placements and cloth/soft shapes. Roles stay for the next Play.

  • Operation physics.apply
  • In Model
ArgumentTypeDefaultDescription
stagedstr—Staged.
clothstr—Cloth.

Clear Physics Body

tb.ops.physics.body.clear(*, node: str) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.body.clear
  • In Model
ArgumentTypeDefaultDescription
nodestrrequiredConfigured object's id; accepts a deleted object's id so its stale role can be removed.

Set Physics Body

tb.ops.physics.body.set(
    *,
    node: ObjectRef,
    role: Literal["static", "rigid", "cloth", "soft"],
    density: float = 1000.0,
    friction: float = 0.5,
    restitution: float = 0.1,
    ccd: bool = False,
    fabric: Literal["silk", "cotton", "denim", "leather", "rubber"] = "cotton",
    stiffness: Literal["soft", "default", "firm"] = "default",
    pressure: float = 3000.0,
    pin_selected: bool = False,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.body.set
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredNode.
roleLiteral["static", "rigid", "cloth", "soft"]requiredRole (static / rigid / cloth / soft).
densityfloat1000.0Rigid bodies: mass per cubic metre. (1…50000).
frictionfloat0.5Contact grip. Cloth defaults to its fabric's friction. (0…2).
restitutionfloat0.1Rigid bounce. (0…1).
ccdboolFalseRigid bodies: continuous collision, so fast bodies cannot pass through thin colliders.
fabricLiteral["silk", "cotton", "denim", "leather", "rubber"]"cotton"Cloth fabric: stretch, shear and bend response and damping. (silk / cotton / denim / leather / rubber).
stiffnessLiteral["soft", "default", "firm"]"default"Soft-body firmness. (soft / default / firm).
pressurefloat3000.0Soft bodies: enclosed gas pressure n·R·T, which keeps a closed surface inflated. (0…150000).
pin_selectedboolFalseCloth: hold the currently selected vertices where the simulation starts.

Close Physics

tb.ops.physics.close() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.close
  • In Model

Set Cloth Map

tb.ops.physics.cloth_map(
    *,
    node: ObjectRef,
    kind: Literal["pin", "stiffness"],
    weights: Any = ...,
) -> Result

Write or clear a cloth object's painted Pin or Stiffness weight map. Pin 1 holds a vertex where the simulation starts; Stiffness 1 makes its fabric up to 20× stiffer. One undo step.

  • Operation physics.cloth_map
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRefrequiredNode.
kindLiteral["pin", "stiffness"]requiredKind (pin / stiffness).
weightsAny—One 0–1 weight per vertex; omit it to clear the map.

Paint Cloth Map

tb.ops.physics.cloth_paint(
    *,
    node: ObjectRef = ...,
    kind: Literal["pin", "stiffness"] = "pin",
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.cloth_paint
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—Cloth object to paint; leave out to stop painting.
kindLiteral["pin", "stiffness"]"pin"Kind (pin / stiffness).

Drag Physics Body

tb.ops.physics.drag(
    *,
    node: ObjectRef = ...,
    point: Vec3Like = ...,
    target: Vec3Like = ...,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.drag
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—The Rigid body to pull; leave out to release the current drag.
pointVec3Like—World point grabbed on the body when the drag began; keep it unchanged while moving the target.
targetVec3Like—World point the grabbed point is pulled towards by a damped spring while the world steps.

Drape Cloth

tb.ops.physics.drape(
    *,
    node: ObjectRef = ...,
    frames: int = 120,
    fabric: Literal["silk", "cotton", "denim", "leather", "rubber"] = "cotton",
    source_shape: Literal["current", "base"] = "current",
    pin_selected: bool = True,
    pins: Any = ...,
    gravity: float = -9.81,
    over: Sequence[ObjectRef] = ...,
    floor: bool = True,
    floor_height: float = 0.0,
    iterations: int = 12,
    staged: str = ...,
    targets: Targets = None,
) -> Result

Let one mesh drape under gravity, with selected or explicit pinned vertices and optional floor contact. Preview before baking. Separate targets are independent; use an API batch to group their undo steps.

  • Operation physics.drape
  • Works on selected mesh objects (exactly 1)
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—One mesh object; defaults to the single selected mesh.
framesint120Fixed simulation frames at 60 frames per second. (1…600).
fabricLiteral["silk", "cotton", "denim", "leather", "rubber"]"cotton"The cloth's material: lighter fabrics fold softly, stiffer ones keep their shape. (silk / cotton / denim / leather / rubber).
source_shapeLiteral["current", "base"]"current"The target's visible current shape, or its authored base shape. Model captures the actual placement's view when opening the tool. (current / base).
pin_selectedboolTrueKeep the selected vertices fixed at their starting positions.
pinsAny—Explicit vertex indices to pin, replacing Pin Selected for scripted runs.
gravityfloat-9.81Vertical acceleration in metres per second squared. (-100…100).
overSequence[ObjectRef]—Objects the cloth lands on and folds over, like a table or a body. They stay still.
floorboolTrueAdds a floor the cloth lands on.
floor_heightfloat0.0The height of the floor. (scene units).
iterationsint12How many solver passes run per step; more passes keep the cloth from stretching but take longer. (1…64).
stagedstr—Completed background result; scripts normally leave this out.

Add Wind

tb.ops.physics.force.add(
    *,
    strength: float = ...,
    direction: Vec3Like = ...,
    gust: float = ...,
) -> Result

Wind of the transient Physics world: a steady, gusty push that blows bodies and cloth. It changes live.

  • Operation physics.force.add
  • In Model
ArgumentTypeDefaultDescription
strengthfloat—Push in m/s²; Earth's gravity is 9.81. (-1000…1000).
directionVec3Like—Where the wind blows (normalized).
gustfloat—How much gusts raise and lower its strength over time: 0 is steady. (0…1).

Remove Wind

tb.ops.physics.force.remove(*, index: int) -> Result

Wind of the transient Physics world: a steady, gusty push that blows bodies and cloth. It changes live.

  • Operation physics.force.remove
  • In Model
ArgumentTypeDefaultDescription
indexintrequiredIndex (0…3).

Edit Wind

tb.ops.physics.force.set(
    *,
    index: int,
    strength: float = ...,
    direction: Vec3Like = ...,
    gust: float = ...,
) -> Result

Wind of the transient Physics world: a steady, gusty push that blows bodies and cloth. It changes live.

  • Operation physics.force.set
  • In Model
ArgumentTypeDefaultDescription
indexintrequiredIndex (0…3).
strengthfloat—Push in m/s²; Earth's gravity is 9.81. (-1000…1000).
directionVec3Like—Where the wind blows (normalized).
gustfloat—How much gusts raise and lower its strength over time: 0 is steady. (0…1).

Grab Physics Bodies

tb.ops.physics.grab(*, enabled: bool) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.grab
  • In Model
ArgumentTypeDefaultDescription
enabledboolrequiredTurn the viewport Grab tool on or off. Turning it off ends any drag.

Physics Mode

tb.ops.physics.mode(*, mode: Literal["rigid", "soft", "cloth"]) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.mode
  • In Model
ArgumentTypeDefaultDescription
modeLiteral["rigid", "soft", "cloth"]requiredThe setup tools the panel shows; every role stays in the same world. (rigid / soft / cloth).

Physics World

tb.ops.physics.open() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.open
  • In Model

Pause Physics

tb.ops.physics.pause() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.pause
  • In Model

Play Physics

tb.ops.physics.play() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.play
  • In Model

Remesh to Quads

tb.ops.physics.remesh_to_quads(
    *,
    node: ObjectRef = ...,
    edge_length: float = 0.02,
) -> Result

Rebuild a cloth panel as even quads for simulation: a quad grid filling its outline, or pure-quad remeshing when that fails. Refuses results with any non-quad face. One undo step.

  • Operation physics.remesh_to_quads
  • In Model
ArgumentTypeDefaultDescription
nodeObjectRef—The panel mesh object; defaults to the active object.
edge_lengthfloat0.02About how long each quad edge is. (scene units; 0.0001…10).

Reset Physics

tb.ops.physics.reset() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.reset
  • In Model

Settle Rigid Bodies

tb.ops.physics.rigid_settle(
    *,
    nodes: Sequence[ObjectRef] = ...,
    colliders: Sequence[ObjectRef] = ...,
    frames: int = 120,
    gravity: Vec3Like = [0.0, -9.81, 0.0],
    density: float = 1000.0,
    friction: float = 0.5,
    restitution: float = 0.0,
    damping: float = 0.05,
    contact_distance: float = 0.002,
    iterations: int = 16,
    source_shapes: Any = ...,
    staged: str = ...,
    targets: Targets = None,
) -> Result

Let selected convex rigid bodies settle against static triangle meshes, preview the final poses, then Apply or Cancel. Moving shapes use their convex hulls.

  • Operation physics.rigid_settle
  • Works on selected mesh objects
  • In Model
ArgumentTypeDefaultDescription
nodesSequence[ObjectRef]—Moving mesh placements; defaults to selected objects.
collidersSequence[ObjectRef]—Static mesh placements; defaults to other visible meshes.
framesint120Simulation frames at 60 frames per second. (1…600).
gravityVec3Like[0.0, -9.81, 0.0]World acceleration in metres per second squared.
densityfloat1000.0Moving-body mass per cubic metre (kg/m³). (1…50000).
frictionfloat0.5Resistance to sliding at contacts. (0…2).
restitutionfloat0.0Bounce at impact: 0 absorbs normal motion; 1 returns it. (0…1).
dampingfloat0.05Velocity decay per second; 0 preserves free motion. (0…20).
contact_distancefloat0.002How close bodies must come to count as touching; smaller values settle more precisely but more slowly. (scene units; 0.00001…0.1).
iterationsint16How many solver passes run per step; more passes stop bodies sinking into each other but take longer. (1…64).
source_shapesAny—Per-placement current/base Model source requests.
stagedstr—Completed background result; ordinary scripts omit this.

Sew Edges

tb.ops.physics.seam.edges(
    *,
    node_a: ObjectRef = ...,
    edge_a: Sequence[int] = ...,
    node_b: ObjectRef = ...,
    edge_b: Sequence[int] = ...,
    rest_length: float = 0.0,
    compliance: float = 0.0,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.seam.edges
  • In Model
ArgumentTypeDefaultDescription
node_aObjectRef—Defaults to the two selected edges, one on each cloth mesh.
edge_aSequence[int]—The edge's two vertex indices.
node_bObjectRef—Node B.
edge_bSequence[int]—Edge B.
rest_lengthfloat0.0Rest Length (scene units; 0…10).
compliancefloat0.0Compliance (0…1).

Remove Seam

tb.ops.physics.seam.remove(*, seam_id: str) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.seam.remove
  • In Model
ArgumentTypeDefaultDescription
seam_idstrrequiredSeam Id.

Add Seam

tb.ops.physics.seam.stroke(
    *,
    node_a: ObjectRef,
    start_a: Vec3Like,
    end_a: Vec3Like = ...,
    node_b: ObjectRef,
    start_b: Vec3Like,
    end_b: Vec3Like = ...,
    rest_length: float = 0.0,
    compliance: float = 0.0,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.seam.stroke
  • In Model
ArgumentTypeDefaultDescription
node_aObjectRefrequiredFirst cloth panel.
start_aVec3LikerequiredWorld point on the first panel's open boundary where the seam starts.
end_aVec3Like—Where the seam ends on that boundary. With ends on both panels the segments are sewn by length, so distant panels pull together; without, the seam follows adjacent boundaries.
node_bObjectRefrequiredSecond cloth panel (may be the first).
start_bVec3LikerequiredStart B.
end_bVec3Like—End B.
rest_lengthfloat0.0Stitch length; 0 sews the edges together. (scene units; 0…10).
compliancefloat0.00 sews rigidly; higher values let the seam stretch. (0…1).

Cloth Self Collision

tb.ops.physics.self_collision(
    *,
    enabled: bool = False,
    thickness: float = 0.005,
    iterations: int = 2,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.self_collision
  • In Model
ArgumentTypeDefaultDescription
enabledboolFalseKeep cloth and soft bodies from passing through themselves and each other (layering).
thicknessfloat0.005Distance kept between a vertex and any other cloth surface. (scene units; 0.0001…0.1).
iterationsint2Contact detection passes per step; more catch fast folds. (1…16).

Physics Settings

tb.ops.physics.settings(
    *,
    gravity: Vec3Like = [0.0, -9.81, 0.0],
    air_drag: float = 0.0,
    ground: bool = True,
    ground_height: float = 0.0,
    iterations: int = 16,
    contact_distance: float = 0.002,
    damping: float = 0.05,
    bounce_threshold: float = 1.0,
    quality: Literal["fast", "default", "quality"] = "default",
    sleep_delay: float = 0.5,
    penetration_slop: float = 0.0,
    error_correction: float = 0.05,
) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.settings
  • In Model
ArgumentTypeDefaultDescription
gravityVec3Like[0.0, -9.81, 0.0]World gravity in m/s²: point it elsewhere or set it to zero to override Earth's pull.
air_dragfloat0.0Air resistance: the share of their speed bodies and cloth lose each second. (0…20).
groundboolTrueAn endless floor at the ground height that bodies land on.
ground_heightfloat0.0Ground Height.
iterationsint16Iterations (1…64).
contact_distancefloat0.002Contact Distance (0.00001…0.1).
dampingfloat0.05Damping (0…20).
bounce_thresholdfloat1.0Impacts slower than this (m/s) do not bounce, so resting bodies settle. (0…100).
qualityLiteral["fast", "default", "quality"]"default"Solver effort: Fast 8, Default 16, Quality 32 rigid iterations (cloth 8/12/24). (fast / default / quality).
sleep_delayfloat0.5Seconds a body must stay nearly still before it sleeps; 0 keeps every body awake. (seconds; 0…60).
penetration_slopfloat0.0Contact overlap accepted without correction. (scene units; 0…0.1).
error_correctionfloat0.05Share of a contact overlap removed each step: higher pushes overlapping bodies and cloth apart faster but can jitter. (0…1).

Physics State

tb.ops.physics.state() -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.state
  • In Model

Step Physics

tb.ops.physics.step(*, frames: int = 1) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.step
  • In Model
ArgumentTypeDefaultDescription
framesint1Frames (1…600).

Move Physics Bodies

tb.ops.physics.transform(*, transforms: Any) -> Result

Control the transient Physics world of static, rigid, cloth and soft bodies. Only Apply writes the Model document. Hosted work reports pending until its accepted frame arrives.

  • Operation physics.transform
  • In Model
ArgumentTypeDefaultDescription
transformsAnyrequiredList of {node, matrix}: a Rigid body id and its new 16-number column-major world matrix. Bodies move and rotate at rest; scale stays as authored.