Skip to content

OperationOptions

OperationOptions = object

Options you can pass to control how an operation executes.

These settings let you tune operation performance, error handling, and UI behavior. Most operations work fine with the defaults, but you can disable the UI for faster execution, adjust batch sizes for large instruction sets, or make operations transparent to avoid cluttering the undo stack.

let model = await SketchUpApi.getActiveModel();
// Disable UI rendering for faster execution
await model.performOperation(async op => {
// ... create many entities ...
}, 'Batch Create', { disableUi: true });

optional abortStrategy?: OperationAbortStrategy | OperationAbortStrategyName

Determines how the SDK handles errors during instruction processing. Defaults to OperationAbortStrategy.AbortOnAll.


optional disableUi?: boolean

When true, SketchUp pauses UI rendering while the operation runs. This can significantly speed up operations that create or modify many entities, but the user won’t see intermediate changes. Defaults to true.


optional instructionsPerBatch?: number

How many instructions to send to SketchUp in each batch. Larger batches reduce round-trip overhead for operations with many instructions. Experiment with different values to find the best trade-off for your workload. Defaults to 8192.


optional transparent?: boolean

When true, this operation attaches to the previous operation (if any), creating a single undo entry. This keeps the undo stack clean but can interfere with precise model versioning in the Ruby backend. Defaults to false.

SDK 2.12.0 protocol 1.9.0


optional whenOperationInProgress?: OperationInProgressResolution

Determines how the API behaves when there are concurrent attempts to start an operation. If omitted defaults to the global configuration.

to enable queuing

let model = await SketchUpApi.getActiveModel();
// try the same without queuing to see the difference in behavior
await Promise.all([
model.performOperation(
(op) => op.modelSetAttribute('Example', 'Value1', 123),
'First operation (no queuing)',
// Note: only overriding for this example, as that depends on connection config.
{whenOperationInProgress: 'error'}),
model.performOperation(
(op) => op.modelSetAttribute('Example', 'Value1', 456),
'Second operation (queuing)',
{whenOperationInProgress: 'queue'}),
]);
model = await model.refresh();
console.log(model.attributes.findValue('Example', 'Value1'), model.attributes.findValue('Example', 'Value2'));

ConnectOptions.whenOperationInProgress

SDK 2.36.0