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.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();// Disable UI rendering for faster executionawait model.performOperation(async op => { // ... create many entities ...}, 'Batch Create', { disableUi: true });Properties
Section titled “Properties”abortStrategy?
Section titled “abortStrategy?”
optionalabortStrategy?:OperationAbortStrategy|OperationAbortStrategyName
Determines how the SDK handles errors during instruction processing. Defaults to OperationAbortStrategy.AbortOnAll.
disableUi?
Section titled “disableUi?”
optionaldisableUi?: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.
instructionsPerBatch?
Section titled “instructionsPerBatch?”
optionalinstructionsPerBatch?: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.
transparent?
Section titled “transparent?”
optionaltransparent?: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
whenOperationInProgress?
Section titled “whenOperationInProgress?”
optionalwhenOperationInProgress?:OperationInProgressResolution
Determines how the API behaves when there are concurrent attempts to start an operation. If omitted defaults to the global configuration.
Example
Section titled “Example”to enable queuing
let model = await SketchUpApi.getActiveModel();
// try the same without queuing to see the difference in behaviorawait 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'));Default
Section titled “Default”ConnectOptions.whenOperationInProgress
SDK 2.36.0