Units

Units

new Units(unit_system, unitsObject)

Create a units object using the default value for Metric or Imperial.

Parameters:
Name Type Default Description
unit_system 'metric' | 'imperial'
unitsObject UnitsObject null
Source:
Example
// Default values for metric | imperial
{
 "length": "m" | 'ft',
 "section_length": "mm" | 'in',
 "material_strength": "mpa" | 'ksi',
 "density": "kg/m3" | 'lb/ft3',
 "force": "kn" | 'kip',
 "moment": "kn-m" | 'kip-ft',
 "pressure": "kpa" | 'ksf',
 "mass": "kg" | 'kip',
 "translation": "mm" | 'in',
 "stress": "mpa" | 'ksi'
}

Methods

(static) set(unitsObject)

Set individual properties of the units object. Imperial and Metric MUST NOT be mixed.

Parameters:
Name Type Description
unitsObject UnitsObject

An object of key value pairs.

Source:
Example
const unitsObj = new UnitsObject{
 "length": "mm",
 "pressure": "kpa"
}

(static) setDefaultImperial()

Set the unit system to the default metric values.

Source:
Example
// Default values for imperial
{
	length: 'ft',
	section_length: 'in',
	material_strength: 'ksi',
	density: 'lb/ft3',
	force: 'kip',
	moment: 'kip-ft',
	pressure: 'ksf',
	mass: 'kip',
	translation: 'in',
	stress: 'ksi',
}

(static) setDefaultMetric()

Set the unit system to the default metric values.

Source:
Example
// Default values for metric
{
 "length": "m",
 "section_length": "mm",
 "material_strength": "mpa",
 "density": "kg/m3",
 "force": "kn",
 "moment": "kn-m",
 "pressure": "kpa",
 "mass": "kg",
 "translation": "mm",
 "stress": "mpa"
}

(static) setUnitSystem(unit_system)

The units object using the default value for Metric or Imperial.

Parameters:
Name Type Description
unit_system 'metric' | 'imperial'
Source:
Example
// Default values for metric | imperial
{
 "length": "m" | 'ft',
 "section_length": "mm" | 'in',
 "material_strength": "mpa" | 'ksi',
 "density": "kg/m3" | 'lb/ft3',
 "force": "kn" | 'kip',
 "moment": "kn-m" | 'kip-ft',
 "pressure": "kpa" | 'ksf',
 "mass": "kg" | 'kip',
 "translation": "mm" | 'in',
 "stress": "mpa" | 'ksi'
}

Type Definitions

UnitsObject :Object

Properties:
Name Type Description
length "ft" | "in" | "mm" | "m"
section_length "in" | "mm"
material_strength "ksi" | "psi" | "mpa"
density "lb/ft3" | "kg/m3"
force "kip" | "lb" | "kn" | "n" | "kg"
moment "kip-ft" | "lb-ft" | "lb-in" | "kn-m" | "n-m" | "kg-m"
pressure "ksi" | "ksf" | "psi" | "psf" | "kpa" | "mpa" | "pa"
mass "kip" | "lb" | "kg"
translation "mm" | "in"
stress "ksi" | "psi" | "mpa" | "kpa"
Source: