tool_set

Activates a tool of the viewport. An open session is interrupted as its tool's descriptor says (cancel by default). tool lists each tool's phases and the params schema of each CreateContent kind its commits make. With tool 'navigate', drag says what a primary drag does (orbit by default). With tool 'select' on a 3D viewport, kept per viewport until changed: marqueeModifier 'alt' (default: an Alt primary drag on empty space is the marquee, Shift adding and Ctrl/Cmd toggling while Alt is held) or 'none' (a plain primary drag on empty space is the marquee; orbit then needs another button); marquee 'rect' (default) or 'lasso'; through (default false) selects through the scene, and Alt+Z toggles it. A left-to-right marquee is a window, right to left a crossing. invalid_params for these on another tool or a 2D viewport, and for marqueeModifier 'alt' while a marquee.* pointer role is on Alt.

Command

Usage

TypeScript
surface.execute('tool_set', { tool, drag?, marqueeModifier?, marquee?, through?, viewport? })

Parameters

  • toolstring

    Required

  • drag"orbit" | "pan" | "zoom"

    with tool 'navigate': what a primary drag does

    Optional

  • marqueeModifier"alt" | "none"

    with tool 'select' (3D): what starts the marquee

    Optional

  • marquee"rect" | "lasso"

    with tool 'select' (3D): the marquee's shape

    Optional

  • throughboolean

    with tool 'select' (3D): the marquee selects through the scene

    Optional

  • viewportstring

    the host's viewport id; default: the engine's first viewport

    Optional

Returns

object, in the ok: true envelope.

JSON
{
  "type": "object",
  "properties": {}
}

See also