MArgList
The MArgList
class provides an entry point for a list of arguments that are passed to your command plug-in.
MArgList
is similar to the argc
and argv
parameters in C and C++. However, an important difference between MArgList
and argv
/argc
parameters is that the zeroth element of an MArgList
is the first argument to the command and not the command name itself.
The list of arguments is passed to MPxCommand::doIt()
. For example,
MStatus doHelix::doIt( const MArgList& args )
Use a loop to parse the individual arguments from the list. For example,
// Parse the arguments.
for ( i = 0; i < args.length(); i++ )
if ( MString( "-p" ) == args.asString( i ) )
pitch = args.asDouble( ++i );
else if ( MString( "-r" ) == args.asString( i ) )
radius = args.asDouble( ++i );