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
|
|||||||||
scaleObject.worldScale |
object |
<optional> |
The world scale
Properties
|
|||||||||
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
-
<static> getFormattedValue(measurementValue, unit, precision, useFractionalCharacters, showTrailingZero)
-
A static method that returns the formatted value and unit.
Parameters:
Name Type Description measurementValuenumber A value to be formatted to be fractional value or decimal value based on precision. unitstring The unit of the measurement. precisionnumber The precision of the measurement. useFractionalCharactersboolean Whether to use fractional characters, e.g. ΒΌ as opposed to 1/4 showTrailingZeroboolean Whether to show trailing zeros for fractional values, e.g. show 10'-1 0" if true, and show 10'-1" if false. Returns:
A formatted value which is either fractional when precision is '1/8, 1/16, 1/32 or 1/64', or a decimal value if not- Type
- string
-
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