UnitsManager (hwx.inspire.core)¶

Manages the various unit systems used throughout the application.

• guiUnits - for displaying/setting numeric values in the gui.
• solverUnits - for converting numbers when exporting to a solver.
• currentUnits - 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, …

Public Methods¶

 addUsingSystem (self, name, units) castUnitSystem (self, units) getSolverUnits (self, system=None) getUsingUnits (self) usingUnits (self, system)

Property Details¶

solverUnits()

Returns units used for exporting to MotionSolve.

Method Details¶

addUsingSystem(self, name, units)

Adds a unit system that can be found by name when calling usingUnits.

param name: Name of the unit system. str Specify the Units to associate with name. Units
castUnitSystem(self, units)

Returns units system from the specified units.

param units: Units can be base,gui,solver, any system like MKS, IPS, MPA, CGS,… Units The units system specified by units. Units
getSolverUnits(self, system=None)

Returns units for exporting to MotionSolve.

param system: Name of the unit system. If no system is specified, use the one specified in the preferences settings Inspire > Units > Model units. The system is specified from the Export menu of theAnalysisSettingsDialog. Units The solver unit system. Units
getUsingUnits(self)

Returns the current unit system.

returns: The current unit system. 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”, … str