Skip to content

Imperial Unit Service

Class full path: NemAll_Python_AllplanSettings.ImperialUnitService

Imperial unit service

Functions

ConvertToMM(imperialValue) staticmethod

Convert an imperial length unit to mm

Parameters:

Name Type Description Default
imperialValue str

Imperial value as string

required

Returns:

Type Description
bool

TRUE when input string was NOT recognised as imperial value

float

Length in mm

Examples:

>>> ConvertToMM("4"")
(False, 101.6)
>>> ConvertToMM("0"")
(False, 0.0)
>>> ConvertToMM("4 in")
(True, 0.0)

ConvertTokg(imperialValue) staticmethod

Convert an imperial weight unit to kg

Parameters:

Name Type Description Default
imperialValue str

Imperial value as string

required

Returns:

Type Description
bool

TRUE when input string was NOT recognised as imperial value

float

Weight in kg

Examples:

>>> ConvertTokg("4 lb")
(False, 1.814368)
>>> ConvertTokg("0 lb")
(False, 0.0)
>>> ConvertTokg("4 oz")
(True, 0.0)

IsImperialUnit() staticmethod

Check whether the current input unit is imperial unit

Returns:

Type Description
bool

Imperial unit input: True/False