Next: , Previous: Property types and subtypes, Up: Properties



6.5.2 Units

Property values which are real numbers have an additional feature – units. A unit defines a multiplier used for displaying thu number in the GUI. All property values stored use a canonical internal unit; for example, all coordinates are in millimeters.

The formula for displayed values is: mathkernel4

The units are stored in an array and the properties contain their indices. When the user changes the display unit, he only modifies the property unit index and the internal property value is remains unchanged.

There are properties of the following four quantities:

The quantity of a property is determined by the type and subtype and can be found in the following way (for a property prop): prop_subtype2quantity[prop->type][prop->subtype].

Default unit

Every quantity has a default unit which is stored in uns unit_default. If the unit of a property is PROP_UNIT_MAX or a deleted unit, the default unit (for the appropriate quantity) is used instead. The default unit cannot be PROP_UNIT_MAX.

Deleting units

Checking whether a certain unit is used in some objects would be too slow. Therefore, a unit cannot be simply deleted. Instead, it is marked as unused and it cannot be assigned to properties any more. If a property that has a deleted unit needs to be displayed, it uses the default unit instead.

The default unit cannot be deleted.