# MFnUnitAttribute

## Base Class

MFnAttribute

## Constants

Name | Type | Description
--- | --- | ---
Unit Types
kInvalid | int |
kAngle | int |
kDistance | int |
kTime | int |
kLast | int | Last value. Used for counting.

## Static Methods

None.

## Static Attributes

None.

## Constructors

Signature | Parameters | Description
--- | --- | ---
MFnUnitAttribute() |  | Default constructor. Returns a new MFnUnitAttribute function set with no Maya object attached.
MFnUnitAttribute(object) | object - MObject | Returns a new MFnUnitAttribute function set, attached to the specified Maya object.

## Object Methods

Signature | Parameters | Returns | Description
--- | --- | --- | ---
create(longName, shortName, type, defaultValue=0.0) | longName - string shortName - string type - Unit Type constant defaultValue - float | MObject | Creates a new attribute of the given type with the given longName, shortName and defaultValue, attaches it to the function set and returns it in an MObject.
create(longName, shortName, defaultValue) | longName - string shortName - string defaultValue - MAngle, MDistance or MTime | MObject | Creates a new angle, distance or time attribute, depending upon the type of the defaultValue, with the given longName, shortName, attaches it to the function set and returns it in an MObject.
getMax() |  | MAngle, MDistance or MTime | Returns the attribute's hard maximum value. Raises a RuntimeError if the attribute does not have a hard maximum.
getMin() |  | MAngle, MDistance or MTime | Returns the attribute's hard minimum value. Raises a RuntimeError if the attribute does not have a hard minimum.
getSoftMax() |  | MAngle, MDistance or MTime | Returns the attribute's soft maximum value. Raises a RuntimeError if the attribute does not have a soft maximum.
getSoftMin() |  | MAngle, MDistance or MTime | Returns the attribute's soft minimum value. Raises a RuntimeError if the attribute does not have a soft minimum.
hasMax() |  | bool | Returns True if a hard maximum value has been specified for the attribute.
hasMin() |  | bool | Returns True if a hard minimum value has been specified for the attribute.
hasSoftMax() |  | bool | Returns True if a soft maximum value has been specified for the attribute.
hasSoftMin() |  | bool | Returns True if a soft minimum value has been specified for the attribute.
setMax(maxValue) | maxValue - float, MAngle, MDistance or MTime | Reference to self. | Sets the attribute's hard maximum to maxValue
setMin(minValue) | minValue - float, MAngle, MDistance or MTime | Reference to self. | Sets the attribute's hard minimum to minValue.
setSoftMax(maxValue) | maxValue - float, MAngle, MDistance or MTime | Reference to self. | Sets the attribute's soft maximum to maxValue.
setSoftMin(minValue) | minValue - float, MAngle, MDistance or MTime | Reference to self. | Sets the attribute's soft minimum to minValue.
unitType() |  | Unit Type constant | Returns the type of data handled by the attribute.

## Object Attributes

Name | Type | Access | Description
--- | --- | --- | ---
default | MAngle, MDistance or MTime | RW | Default value of attribute.

## Sequence Support

None.

## Number Support

None.

## Comparison Support

None.

© 2011 Autodesk, Inc. All rights reserved.