Skip to content

ToolState

The active tool and its current state code.

Retrieve the active tool with model.tools.getActive(), or subscribe to changes with model.tools.observeToolChanges().

The state number is tool-specific — its meaning varies per tool and is not consistent across the SketchUp toolset.

let model = await SketchUpApi.getActiveModel();
// React to tool state changes
model.tools.observeToolChanges(change => {
if (change.event === 'StateChange') {
console.log(change.state.tool.name);
console.log(change.state.state);
}
});
  • Tool
  • SketchupTools.getActive
  • SketchupTools.observeToolChanges

SDK 1.19.0 protocol 1.16.0

readonly state: number

A numeric code representing the tool’s current state. The meaning varies per tool and is not standardized.


readonly tool: Tool

The tool that is currently active.