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”options
Section titled “options”
readonlyoptions:OptionsProvider
Accessors
Section titled “Accessors”anglePrecision
Section titled “anglePrecision”Get Signature
Section titled “Get Signature”get anglePrecision():
number
Number of decimal places shown for angle measurements,
like 1.
Returns
Section titled “Returns”number
angleSnapEnabled
Section titled “angleSnapEnabled”Get Signature
Section titled “Get Signature”get angleSnapEnabled():
boolean
Whether angle snapping is enabled when rotating.
Returns
Section titled “Returns”boolean
areaPrecision
Section titled “areaPrecision”Get Signature
Section titled “Get Signature”get areaPrecision():
number
Number of decimal places shown for area measurements.
Returns
Section titled “Returns”number
areaUnit
Section titled “areaUnit”Get Signature
Section titled “Get Signature”get areaUnit():
AreaUnit
The unit used to display area measurements, like
AreaUnit.SquareFeet.
Returns
Section titled “Returns”forceInchDisplay
Section titled “forceInchDisplay”Get Signature
Section titled “Get Signature”get forceInchDisplay():
boolean
Controls how inch quotes are shown in the SketchUp UI. If true,
show 5" for example, vs 5.
Returns
Section titled “Returns”boolean
lengthFormat
Section titled “lengthFormat”Get Signature
Section titled “Get Signature”get lengthFormat():
LengthFormat
The format used to display lengths — decimal, architectural (feet and inches), fractional, or engineering.
Returns
Section titled “Returns”lengthPrecision
Section titled “lengthPrecision”Get Signature
Section titled “Get Signature”get lengthPrecision():
number
Number of decimal places shown for length measurements,
like 2.
Returns
Section titled “Returns”number
lengthSnapEnabled
Section titled “lengthSnapEnabled”Get Signature
Section titled “Get Signature”get lengthSnapEnabled():
boolean
Whether length snapping is enabled when drawing.
Returns
Section titled “Returns”boolean
lengthSnapLength
Section titled “lengthSnapLength”Get Signature
Section titled “Get Signature”get lengthSnapLength():
number
The snap increment for length input when snapping is enabled.
Returns
Section titled “Returns”number
lengthUnit
Section titled “lengthUnit”Get Signature
Section titled “Get Signature”get lengthUnit():
LengthUnit
The unit used to display lengths, like LengthUnit.Inches.
Returns
Section titled “Returns”Get Signature
Section titled “Get Signature”get name():
string
The internal name of this options provider, like
'UnitsOptions'.
Returns
Section titled “Returns”string
snapAngle
Section titled “snapAngle”Get Signature
Section titled “Get Signature”get snapAngle():
number
The snap increment for angle input in degrees when snapping is enabled.
Returns
Section titled “Returns”number
suppressUnitsDisplay
Section titled “suppressUnitsDisplay”Get Signature
Section titled “Get Signature”get suppressUnitsDisplay():
boolean
Whether unit labels are hidden from dimension and length displays.
Returns
Section titled “Returns”boolean
volumePrecision
Section titled “volumePrecision”Get Signature
Section titled “Get Signature”get volumePrecision():
number
Number of decimal places shown for volume measurements.
Returns
Section titled “Returns”number
volumeUnit
Section titled “volumeUnit”Get Signature
Section titled “Get Signature”get volumeUnit():
VolumeUnit
The unit used to display volume measurements, like
VolumeUnit.CubicFeet.
Returns
Section titled “Returns”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