# MSyntax

## Base Class

None.

## Constants

Name | Type | Description
--- | --- | ---
Argument Types
kInvalidArgType | int |
kNoArg | int |
kBoolean | int |
kLong | int |
kDouble | int |
kString | int |
kUnsigned | int |
kDistance | int |
kAngle | int |
kTime | int |
kSelectionItem | int |
kLastArgType | int |
Object Formats
kInvalidObjectFormat | int |
kNone | int |
kStringObjects | int |
kSelectionList | int |
kLastObjectFormat | int |

## Static Methods

None.

## Constructors

Signature | Parameters | Description
--- | --- | ---
MSyntax() |  | Default constructor. Returns a new, empty MSyntax object.
MSyntax(src) | src - MSyntax | Copy constructor. Returns a new MSyntax object with the same value as src.

## Virtual Methods

None.

## Object Methods

Signature | Parameters | Returns | Description
--- | --- | --- | ---
addArg(argType) | argType - Argument Type constant | Reference to self. | Add a command argument.
addFlag(shortName, longName, argTypes) | shortName - string longName - string argTypes - Argument Type constant orsequence of Argument Type constants | Reference to self. | Add a flag and its arguments. Raises TypeError if more than 6 argument types are provided.
makeFlagMultiUse(flagName) | flagName - string | Reference to self. | Set whether a flag may be used multiple times on the command line.
makeFlagQueryWithFullArgs(flagName, argsOptional) | flagName - string argsOptional - bool | Reference to self. | Set whether a flag requires its args when queried.
maxObjects() |  | int | Returns the maximum number of objects which can be passed to the command. If no maximum has been set then the maximum will be unbounded and this method will return 0, which unfortunately is indistinguishable from the situation where the maximum has been set to 0.
minObjects() |  | int | Returns the minimum number of objects which can be passed to the command. If no minimum has been set then the minimum will default to 0.
setMaxObjects(max) | max - int | Reference to self. | Sets the maximum number of objects which can be passed to the command. If no maximum has been set then the maximum will be unbounded. Raises ValueError if max is negative.
setMinObjects(min) | min - int | Reference to self. | Sets the minimum number of objects which can be passed to the command. If no minimum has been set then the minimum will be 0. Raises ValueError if min is negative.
setObjectType(objType, min=0, max=None) | objType - Object Format constant min - min # of objects max - max # of objects. | Reference to self. | Set the type and number of objects to be passed to the command. Raises ValueError if min or max is negative, or if max is less than min.
useSelectionAsDefault(useSelection) | useSelection - bool | Reference to self. | If set to True then when no objects are provided on the command-line Maya will pass the current selection instead. Defaults to False.

## Object Attributes

Name | Type | Access | Description
--- | --- | --- | ---
enableEdit | bool | RW | Enable support for the -edit flag.
enableQuery | bool | RW | Enable support for the -query flag.

## Sequence Support

None.

## Number Support

None.

© 2011 Autodesk, Inc. All rights reserved.