- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MItSurfaceCV Class Reference
OpenMaya - API module for common classes

This reference page is linked to from the following overview topics: MSelectionList, setObject() method, Using the Maya Python API, Appendix C: Frequently asked questions.

Search for all occurrences

## Detailed Description

NURBS surface CV iterator.

Iterator class for NURBS surface CVs.

Example: Translates the CVs for a surface in the X direction (world space).

        MItSurfaceCV cvIter( surface, true, &stat );
        MVector vector(1.0,0.0,0.0);

        if ( MStatus::kSuccess == stat ) {
            for ( ; !cvIter.isDone(); cvIter.nextRow() )
            {
                for ( ; !cvIter.isRowDone(); cvIter.next() )
                {
                    cvIter.translateBy( vector, MSpace::kWorld );
                }
            }
            cvIter.updateSurface();    // Tell surface is has been changed
        }
        else {
            cerr << "Error creating iterator!" << endl;
        }

Examples:

  componentScaleManip.cpp, cvExpandCmd.cpp, cvPosCmd.cpp, lassoTool.cpp, moveTool.cpp, surfaceTwistCmd.cpp, and translateCmd.cpp.

`#include <MItSurfaceCV.h>`

List of all members.

## Public Member Functions
| MItSurfaceCV (MObject &surface, bool useURows=true, MStatus *ReturnStatus=NULL)
| Constructor.
| MItSurfaceCV (const MDagPath &surface, MObject &component=MObject::kNullObj, bool useURows=true, MStatus *ReturnStatus=NULL)
| Constructor.
virtual | ~MItSurfaceCV ()
| Class destructor.
bool | isDone (MStatus *ReturnStatus=NULL) const
| Returns true if the iteration is finished, i.e.
bool | isRowDone (MStatus *ReturnStatus=NULL) const
| Returns true if the current row has no more CVs to iterate over.
MStatus | next ()
| Advance to the next CV in the iteration.
MStatus | nextRow ()
| Advance to the next row in the iteration.
MStatus | reset ()
| Reset the iterator to the first CV.
MStatus | reset (MObject &surface, bool useURows=true)
| Reset the iterator to iterate over all CVs on the specified surface.
MStatus | reset (const MDagPath &surface, MObject &component, bool useURows=true)
| Reset the iterator to iterate over the CVs of the given surface that are specified in the given component.
MPoint | position (MSpace::Space space=MSpace::kObject, MStatus *ReturnStatus=NULL) const
| Returns the position of the current CV in the iteration in the specified space.
MStatus | setPosition (const MPoint &point, MSpace::Space space=MSpace::kObject)
| Set the position of the current CV in the iteration to the specified point.
MStatus | translateBy (const MVector &vector, MSpace::Space space=MSpace::kObject)
| Move the current CV in the iteration by the sepcified vector.
int | index (MStatus *ReturnStatus=NULL) const
| Get the index of the current CV as it appears in CV array for this surface.
MStatus | getIndex (int &indexU, int &indexV) const
| Get the index of the current CV as it appears in CV array for this surface.
MObject | cv (MStatus *ReturnStatus=NULL) const
| This method is obsolete.
MObject | currentItem (MStatus *ReturnStatus=NULL) const
| Get the current CV in the iteration as a component.
bool | hasHistoryOnCreate (MStatus *ReturnStatus=NULL) const
| This method determines if the shape was created with history.
MStatus | updateSurface ()
| This method is used to signal the surface that it has been changed and needs to redraw itself.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.

## Constructor & Destructor Documentation

MItSurfaceCV | ( | MObject & | surface,
|  | bool | useURows = `true`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

This constructor is used when iterating over all the CVs on the given surface.

Parameters:

  [in] | surface | The surface for the iteration
  [in] | useURows | If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.
  [out] | ReturnStatus | Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MItSurfaceCV | ( | const MDagPath & | surface,
|  | MObject & | component = `MObject::kNullObj`,
|  | bool | useURows = `true`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

This constructor is used when iterating over a group of CVs. If the component is not given then the iteration will be for the whole surface.

Parameters:

  [in] | surface | The surface for the iteration
  [in] | component | A group of CVs to be iterated on
  [in] | useURows | If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.
  [out] | ReturnStatus | Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

## Member Function Documentation

bool isDone | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns true if the iteration is finished, i.e.

there are no more CVs to iterate on.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  Boolean value: true if there are no more CVs to iterate on, false otherwise.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

Examples:
  componentScaleManip.cpp, and cvExpandCmd.cpp.

bool isRowDone | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns true if the current row has no more CVs to iterate over.

The row can be in the U or V direction depending on what value of useURows has been set in the constructor.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  Boolean value: true if the current row in the iteration is finished, false otherwise.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus next | ( |  | ) |

Search for all occurrences

Advance to the next CV in the iteration.

If the iterator is already at the last CV then this method has no effect. Use isDone to determine if the iterator is at the last CV.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus nextRow | ( |  | ) |

Search for all occurrences

Advance to the next row in the iteration.

The row can be in the U or V direction depending on what value of useURows has been set in the constructor.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus reset | ( |  | ) |

Search for all occurrences

Reset the iterator to the first CV.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus reset | ( | MObject & | surface,
|  | bool | useURows = `true`
| ) |  |

Search for all occurrences

Reset the iterator to iterate over all CVs on the specified surface.

Parameters:

  [in] | surface | The surface for the iteration
  [in] | useURows | If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus reset | ( | const MDagPath & | surface,
|  | MObject & | component,
|  | bool | useURows = `true`
| ) |  |

Search for all occurrences

Reset the iterator to iterate over the CVs of the given surface that are specified in the given component.

If the component is NULL then the iteration will be over all CVs on the surface.

Parameters:

  [in] | surface | The surface for the iteration
  [in] | component | A group of CVs to be iterated on
  [in] | useURows | If true then the iterator will iterate in the U direction, otherwise it will be in the V direction.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MPoint position | ( | MSpace::Space | space = `MSpace::kObject`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the position of the current CV in the iteration in the specified space.

Parameters:

  [in] | space | The coordinate space in which the CV is set
  [out] | ReturnStatus | Status code

Returns:
  The position of the current CV in the iteration

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus setPosition | ( | const MPoint & | point,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Set the position of the current CV in the iteration to the specified point.

Parameters:

  [out] | point | The new position for the current CV in the iteration
  [in] | space | The coordinate space in which the CV is set

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus translateBy | ( | const MVector & | vector,
|  | MSpace::Space | space = `MSpace::kObject`
| ) |  |

Search for all occurrences

Move the current CV in the iteration by the sepcified vector.

Parameters:

  [out] | vector | The translation vector
  [in] | space | The coordinate space in which the CV is set

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

int index | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Get the index of the current CV as it appears in CV array for this surface.

The index returned is a single index. To convert this into a double (U,V) index:

        sizeInV = MFnNurbsSurfaceInstance.numCVsInV();
        indexU = index() / sizeInV;
        indexV = index() % sizeInV;

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  The index for the current CV in the iteration

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus getIndex | ( | int & | indexU,
|  | int & | indexV
| ) |  | const

Search for all occurrences

Get the index of the current CV as it appears in CV array for this surface.

The index returned is a double (U,V) index. To convert this into a single index:

        index = numCVsInV()*indexU + indexV

Parameters:

  [out] | indexU | Storage for the u index
  [out] | indexV | Storage for the v index

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MObject cv | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

This method is obsolete.

Deprecated:
  Use the MItSurfaceCV::currentItem method.

Get the current CV in the iteration as a component.

Components are used to specify one or more CVs and are usefull in operating on groups of non-contiguous CVs for a curve or surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  The current CV in the interation

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kInsufficientMemory No memory available.
  - MS::kFailure An object error has occurred.

MObject currentItem | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Get the current CV in the iteration as a component.

Components are used to specify one or more CVs and are usefull in operating on groups of non-contiguous CVs for a curve or surface. Components do not contain any information about the surface that they refer to so an MDagPath must be specified when dealing with components.

Parameters:

  [out] | ReturnStatus | Status code

Returns:
  The current CV in the interation

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kInsufficientMemory No memory available.
  - MS::kFailure An object error has occurred.

bool hasHistoryOnCreate | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

This method determines if the shape was created with history.

If the object that this iterator is attached to is not a shape then this method will fail.

Parameters:

  [out] | ReturnStatus |

Returns:
  Boolean value: true if the shape has history, false otherwise.

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

MStatus updateSurface | ( |  | ) |

Search for all occurrences

This method is used to signal the surface that it has been changed and needs to redraw itself.

When modifying a large number of CVs, it is most efficient to call this method after all of the CVs have been modified.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The method was successful.
  - MS::kFailure An object error has occurred.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV
MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV MItSurfaceCV