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.
Example
Section titled “Example”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.Metersawait opts.update({ LengthUnit: 4 });let updated = await opts.refresh();console.log(updated.lengthUnit);// => 4 (LengthUnit.Meters)Properties
Section titled “Properties”anglePrecision
Section titled “anglePrecision”
readonlyanglePrecision:number
Number of decimal places shown for angle measurements,
like 1.
angleSnapEnabled
Section titled “angleSnapEnabled”
readonlyangleSnapEnabled:boolean
Whether angle snapping is enabled when rotating.
areaPrecision
Section titled “areaPrecision”
readonlyareaPrecision:number
Number of decimal places shown for area measurements.
areaUnit
Section titled “areaUnit”
readonlyareaUnit:AreaUnit
The unit used to display area measurements, like
AreaUnit.SquareFeet.
forceInchDisplay
Section titled “forceInchDisplay”
readonlyforceInchDisplay:boolean
Controls how inch quotes are shown in the SketchUp UI. If true,
show 5" for example, vs 5.
lengthFormat
Section titled “lengthFormat”
readonlylengthFormat:LengthFormat
The format used to display lengths — decimal, architectural (feet and inches), fractional, or engineering.
lengthPrecision
Section titled “lengthPrecision”
readonlylengthPrecision:number
Number of decimal places shown for length measurements,
like 2.
lengthSnapEnabled
Section titled “lengthSnapEnabled”
readonlylengthSnapEnabled:boolean
Whether length snapping is enabled when drawing.
lengthSnapLength
Section titled “lengthSnapLength”
readonlylengthSnapLength:number
The snap increment for length input when snapping is enabled.
lengthUnit
Section titled “lengthUnit”
readonlylengthUnit:LengthUnit
The unit used to display lengths, like LengthUnit.Inches.
readonlyname:string
The internal name of this options provider, like
'UnitsOptions'.
options
Section titled “options”
readonlyoptions:OptionsProvider
snapAngle
Section titled “snapAngle”
readonlysnapAngle:number
The snap increment for angle input in degrees when snapping is enabled.
suppressUnitsDisplay
Section titled “suppressUnitsDisplay”
readonlysuppressUnitsDisplay:boolean
Whether unit labels are hidden from dimension and length displays.
volumePrecision
Section titled “volumePrecision”
readonlyvolumePrecision:number
Number of decimal places shown for volume measurements.
volumeUnit
Section titled “volumeUnit”
readonlyvolumeUnit:VolumeUnit
The unit used to display volume measurements, like
VolumeUnit.CubicFeet.
Methods
Section titled “Methods”refresh()
Section titled “refresh()”refresh():
Promise<UnitOptions>
Re-fetches these options from SketchUp to pick up any changes the user has made since this snapshot was taken.
Returns
Section titled “Returns”Promise<UnitOptions>
SDK 1.18.0
toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string
update()
Section titled “update()”update(
updates):Promise<string[]>
Applies updates to the unit settings. Returns an array of any keys that were rejected as invalid.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
the properties to change |
Returns
Section titled “Returns”Promise<string[]>
rejected keys, or an empty array on success
SDK 1.18.0 protocol 1.15.0