So this is what I ended up with but unfortinatly I could not get it to return any area what so ever on as many variations of curve I tried.......
If anybody is familar with autocad there is such a tool that allows getting the area of a curve.....
CODE
//
// Copyright (C) Matt Blair
//
// File: curveAreaCmdCmd.cpp
//
// MEL Command: curveAreaCmd
//
// Author: Maya Plug-in Wizard 2.0
//
// Includes everything needed to register a simple MEL command with Maya.
//
#include
#include
#include
#include
#include
#include
#include
// Use helper macro to register a command with Maya. It creates and
// registers a command that does not support undo or redo. The
// created class derives off of MPxCommand.
//
DeclareSimpleCommand( curveArea, "Matt Blair", "7.0");
MStatus curveArea::doIt( const MArgList& args )
//
// Description:
// implements the MEL curveAreaCmd command.
//
// Arguments:
// args - the argument list that was passes to the command from MEL
//
// Return Value:
// MS::kSuccess - command succeeded
// MS::kFailure - command failed (returning this value will cause the
// MEL script that is being run to terminate unless the
// error is caught using a "catch" statement.
//
{
MStatus stat = MS::kSuccess;
MSelectionList selection;
MGlobal::getActiveSelectionList( selection );
MDagPath dagPath;
MObject component;
double area, length;
MString txt;
MItSelectionList iter( selection );
for (; !iter.isDone(); iter.next() )
{
iter.getDagPath( dagPath, component );
MFnNurbsCurve curveFn( dagPath, &stat );
if ( stat )
{
area = curveFn.area( 0.1, &stat );
length = curveFn.length( 0.001, &stat );
}
}
txt += "Area: ";
txt += area;
txt += "\nLength: ";
txt += length;
txt += "\n";
clearResult;
MGlobal::displayInfo( txt );
setResult( area );
return stat;
}