Skip to content

UnitOptions

The measurement unit settings for the model — length, area, volume, angle, and snapping.

Access it from model.options.unitOptions. Use it to read which units and precision the model is using, or update them.

let model = await SketchUpApi.getActiveModel();
let opts = model.options.unitOptions;
console.log(opts.lengthUnit);
// => 0 (LengthUnit.Inches)
console.log(opts.lengthPrecision);
// => 2 (decimal places)
// Switch to meters
// 4 = LengthUnit.Meters
await opts.update({ LengthUnit: 4 });
let updated = await opts.refresh();
console.log(updated.lengthUnit);
// => 4 (LengthUnit.Meters)

get anglePrecision(): number

Number of decimal places shown for angle measurements, like 1.

number


get angleSnapEnabled(): boolean

Whether angle snapping is enabled when rotating.

boolean


get areaPrecision(): number

Number of decimal places shown for area measurements.

number


get areaUnit(): AreaUnit

The unit used to display area measurements, like AreaUnit.SquareFeet.

AreaUnit


get forceInchDisplay(): boolean

Controls how inch quotes are shown in the SketchUp UI. If true, show 5" for example, vs 5.

boolean


get lengthFormat(): LengthFormat

The format used to display lengths — decimal, architectural (feet and inches), fractional, or engineering.

LengthFormat


get lengthPrecision(): number

Number of decimal places shown for length measurements, like 2.

number


get lengthSnapEnabled(): boolean

Whether length snapping is enabled when drawing.

boolean


get lengthSnapLength(): number

The snap increment for length input when snapping is enabled.

number


get lengthUnit(): LengthUnit

The unit used to display lengths, like LengthUnit.Inches.

LengthUnit


get name(): string

The internal name of this options provider, like 'UnitsOptions'.

string


get snapAngle(): number

The snap increment for angle input in degrees when snapping is enabled.

number


get suppressUnitsDisplay(): boolean

Whether unit labels are hidden from dimension and length displays.

boolean


get volumePrecision(): number

Number of decimal places shown for volume measurements.

number


get volumeUnit(): VolumeUnit

The unit used to display volume measurements, like VolumeUnit.CubicFeet.

VolumeUnit

refresh(): Promise<UnitOptions>

Re-fetches these options from SketchUp to pick up any changes the user has made since this snapshot was taken.

Promise<UnitOptions>

SDK 1.18.0


toString(): string

string


update(updates): Promise<string[]>

Applies updates to the unit settings. Returns an array of any keys that were rejected as invalid.

Parameter Type Description

updates

UnitOptionsUpdate

the properties to change

Promise<string[]>

rejected keys, or an empty array on success

SDK 1.18.0 protocol 1.15.0