Class: Scale

Core. Scale

A class that encapsulates measurement scale information for converting from and to different units.

new Scale(scaleRatio [, precision])

Parameters:
Name Type Argument Description
scaleRatio object | string | Array.<Array.<(number|string)>> Either an object, string or array containing the scale information. See examples for more detail.
scaleObject.pageScale object <optional>
The page scale of the document
Properties
Name Type Description
value number The number value of the page scale
unit string The unit of the page scale, e.g. cm
scaleObject.worldScale object <optional>
The world scale
Properties
Name Type Description
value number The number value of the world scale
unit string The unit of the world scale, e.g. cm
precision number <optional>
The precision of the scale
Example
const scale1 = new Core.Scale({pageScale: {value: 1, unit: 'in'}, worldScale: {value: 1, unit: 'ft'}}, 0.01);
const scale2 = new Core.Scale([[1, 'in'], [1, 'ft']], 0.01);
const scale2 = new Core.Scale('1 in = 1 ft', 0.01);
const scale2 = new Core.Scale({pageScale: {value: 1, unit: 'in'}, worldScale: {value: 1, unit: 'ft'}});

Methods


getScaleRatioAsArray()

Returns:
Returns the values and units of the page scale and world scale in an array. For example: [[1, 'in'],[1, 'in']].
Type
Array.<Array.<(number|string)>>

toString()

Returns:
Returns string format of scale
Type
string