UnitsModule

The UnitsModule class provides functionality for converting values into world-space units.

Example

//==============================================================================
// The following example demonstrates how to convert values into world-space
// units.
//
// Project setup:
// - Set the default unit via Properties > General > Unit of Measurement
//==============================================================================

// Load in the required modules
const Diagnostics = require('Diagnostics');
const Units = require('Units');

// Create a variable we will use to convert
const value = 5;

// Convert the value into other units
Diagnostics.log(value + ' cm => ' + Units.cm(value));
Diagnostics.log(value + ' ft => ' + Units.ft(value));
Diagnostics.log(value + ' in => ' + Units.in(value));
Diagnostics.log(value + ' m => '  + Units.m(value));
Diagnostics.log(value + ' mm => ' + Units.mm(value));
Diagnostics.log(value + ' yd => ' + Units.yd(value));

Properties

This module exposes no properties.

Methods

Method

Description

cm

cm(centimeters: number): number

Converts the specified centimeter value to world units.

ft

ft(feet: number): number

Converts the specified foot value to world units.

in

in(inches: number): number

Converts the specified inch value to world units.

m

m(meters: number): number

Converts the specified meter value to world units.

mm

mm(millimeters: number): number

Converts the specified millimeter value to world units.

yd

yd(yards: number): number

Converts the specified yard value to world units.

Classes

This module exposes no classes.

Last updated