API Guide > Maya API introduction >

# Adding arguments

The helix plug-in generates a simple curve, but it always produces the same curve (see Building a curve using a plug-in).

## Adding arguments to the curve example

You can make a few changes so you can specify the radius and pitch of the curve. Change the function definition by adding the args parameter name:

    MStatus doHelix::doIt( const MArgList& args )

Add the following lines after the variable declarations:

    // 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 );

This code fragment reads arguments so you can change the pitch and radius of the helix you generate. This change is quite simple:

The for-loop walks through all arguments in the MArgList wrapper. The two if-statements convert the current argument (referenced by the index variable "i") to an MString (the Maya API’s string wrapper class) and compare them with the two possible argument flags.

If there is a match, the next argument is converted to a double and assigned to the appropriate variable. For example:

    doHelix -p 0.5 -r 5

produces a helix with a pitch of 0.5 units and a radius of 5 units.