UnitsManager (hwx.inspire)#

class UnitsManager(project)#

Bases: object

Manages the various unit systems used throughout the application.

  • gui - for displaying/setting numeric values in the gui.

  • solver - for converting numbers when exporting to a solver.

  • current - the system used when setting/getting attribute values.

There is one gui unit system used throughout Inspire. Its system can be set either via the settings dialog or the popup menu on the main window. All numeric gui values are displayed/entered using these units.

The solver units are used when exporting the model to a solver. Every time you ask for the solver units you get a new unit system with its system set from the value in settings.

setting/getting numeric values is ‘current units’. Aware when you call part.mass the value is multiplied the the current units as defined by this class. The current units are specified using the usingUnits context method current units can be:

  • base

  • gui

  • solver

  • any system, like MKS, IPS, MPA, …

Attribute Table#

Name

Type

current

property

gui

property

solver

property

Method Table#

Name

Description

getUnits (self, system)

Returns a common.Units manager for the passed system name.

usingUnits (self, system)

Context to specify the current units.

property gui#

The common.Units manager displayed in the gui.

property solver#

The common.Units manager used for exporting to MotionSolve.

usingUnits(system)#

Context to specify the current units.

Parameters:

system (str) –

System can be

  • base : always SI units, internal units of the data model, this is default.

  • gui : user specified gui units and angle=deg, ang_velocity=rpm.

  • solver : “Model units” from preferences and angle=rad.

  • any unit system: “MKS”, “MMKS”, “IPS, “MPA”, …

property current#

Returns the current unit system.

Returns:

The current unit system.

Return type:

Units

getUnits(system)#

Returns a common.Units manager for the passed system name.

Parameters:

system (str) – Can be base, gui, solver, any system like MKS, IPS, MPA, CGS,…

Returns:

The units system specified by system.

Return type:

Units