UnitsManager (hwx.inspire.core)

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, …

Properties

Public Methods

__new__ (cls, *args, **kwds)

getUnits (self, system)

usingUnits (self, system)

Property Details

property current

Returns the current unit system.

Returns:

Units : The current unit system.

property gui

The common.Units manager displayed in the gui.

property solver

The common.Units manager used for exporting to MotionSolve.

Method Details

__new__(cls, *args, **kwds)

Singleton constructor

getUnits(self, system)

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

param system

Can be base, gui, solver, any system like MKS, IPS, MPA, CGS,…

type system

str

returns

The units system specified by system.

rtype

Units

usingUnits(self, system)

Context to specify the current units.

param system

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”, …

type system

str