NurbsSurfaceMesh.Get2
 
 
 

NurbsSurfaceMesh.Get2 operator

Description

Returns a complete data description of a NurbsSurfaceMesh. The data is returned in a 1-dimensional array and is ordered the same as for the NurbsSurfaceMesh.Get method output arguments.

Note: This method must be used with scripting languages that don't support arguments passed by reference such as JScript and PerlScript. For more information on getting output arguments, see About Output Argument Arrays.

C# Syntax

Object NurbsSurfaceMesh.Get2( siNurbsFormat in_eNurbsFormat );

Scripting Syntax

oArray = NurbsSurfaceMesh.Get2( [NurbsFormat] );

Return Value

Array of Variants ordered as Count, UVControlPoints, NbUControlPoints, NbVControlPoints, UKnots, NbUKnots, VKnots, NbVKnots, UClosed, VClosed, UDegree, VDegree, UParam, VParam.

Parameters

Parameter Type Description
NurbsFormat siNurbsFormat Specifies how the data is formatted.

Default Value: siSINurbs

Examples

JScript Example

// This example shows how to retrieve the output arguments returned by NurbsCurveList.Get2
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oGrid = oRoot.AddGeometry( "Grid", "NurbsSurface" );
oGrid.subdivu = 1;
oGrid.subdivv = 1;
Duplicate( "grid", null, 2, 1, 1, 0, 0, 1, 0, 1 );
AddToSelection( "grid,grid1", null, 1 );
SIAssembleNurbsMesh( null, 0.150, 0, 0, 1 );
SelectObj( "surfmsh" );
// convert VB array to JScript array
var vbArgs = new VBArray(Selection(0).ActivePrimitive.Geometry.Get2( siSINurbs ));
// get the number of surfaces
numSurfs = vbArgs.getItem(0);
LogMessage("number of surfaces: " + numSurfs);
// get the number of control points in U per surface
var uncpts = vbArgs.getItem(2);
uSize = uncpts.ubound(1)-uncpts.lbound(1)+1;
for (i = 0; i < uSize; i++) 
{
        LogMessage("number of control points in U for surface " + i + ": " + uncpts.getItem(i) );
}
// get the number of control points in V per surface
var vncpts = vbArgs.getItem(3)
vSize = vncpts.ubound(1)-vncpts.lbound(1)+1;
for (i = 0; i < vSize; i++) 
{
        LogMessage("number of control points in V for surface " + i + ": " + vncpts.getItem(i) );
}
// get the control point array
var cpts = vbArgs.getItem(1);
// dump all control points
for ( k=0, offset=0; k<numSurfs; offset += uncpts.getItem(k), k++ )
{
        for ( i=0; i<vncpts.getItem(k); i++ ) // V
        {
                for ( j=0; j<uncpts.getItem(k); j++ ) // U
                {
                        idx = j+offset;
                        LogMessage("surf" + k + ": cpts[0]" + "[" + i + "]" + "[" + idx + "]: " + cpts.getItem(0,i,idx));
                        LogMessage("surf" + k + ": cpts[1]" + "[" + i + "]" + "[" + idx + "]: " + cpts.getItem(1,i,idx));
                        LogMessage("surf" + k + ": cpts[2]" + "[" + i + "]" + "[" + idx + "]: " + cpts.getItem(2,i,idx));
                        LogMessage("surf" + k + ": cpts[3]" + "[" + i + "]" + "[" + idx + "]: " + cpts.getItem(3,i,idx));
                }
        }
}

See Also

NurbsSurfaceMesh.Get