Units

Class Units()

Units(parent='MODEL', name='units', label='Units')

Units used in the model.

Keyword Arguments

Argument Data Type Description Default
force Enum Force units. One of "KNEWTON", "KPOUND_FORCE", "NEWTON", "OUNCE_FORCE", "POUND_FORCE", "MILLIGRAM_FORCE". NEWTON
length Enum Length units. One of "KILOMETER", "INCH", "METER", "MILLIMETER", "MILE". MILLIMETER
mass Enum Mass units. One of 'GRAM', 'KILOGRAM', 'KPOUND_MASS', 'OUNCE_MASS', 'POUND_MASS', 'SLUG', 'SLINCH', 'MEGAGRAM', 'MILLIGRAM'. KILOGRAM
time Enum Time units. One of 'HOUR', 'MILLISECOND', 'MINUTE', 'SECOND'. SECOND

Examples

Modify the units used in the model.
   >>> # Import mview module
   >>> from hw import mview
   >>> # Get the model handle
   >>> mod = mview.getModel()
   >>> mod.name
   'the_model'
   >>> # Set the unit used for force as KPOUND_FORCE
   >>> mod.units.force = 'KPOUND_FORCE'
   >>> mod.units.force
   'KPOUND_FORCE'
   >>> # Set the unit used for length as MILE
   >>> mod.units.length = 'MILE'
   >>> mod.units.length
   'MILE'
   >>> # Set the unit used for mass as SLUG
   >>> mod.units.mass = 'SLUG'
   >>> mod.units.mass
   'SLUG'
   >>> # Set the unit used for time as MINUTE
   >>> mod.units.time = 'MINUTE'
   >>> mod.units.time
   'MINUTE'

Methods

getValue(name)

Returns value of an attribute.

Parameters:

name (str) : Name of the attribute. Defaults to :.

Returns:

The return value. Return type depends on the attribute type.

Return type:

(list)

setValue(name, value)
Sets value of an attribute.

Parameters:

     
name str Name of the attribute.
value any Value of the attribute to be set.

Returns:

Returns True if the value was successfully set else False.

Return type:

bool